def prepare_body()

in amazon_transcribe/request.py [0:0]


    def prepare_body(self) -> BODY_TYPE:
        body = self.body
        if body is None:
            return BytesIO(b"")
        elif isinstance(body, str):
            return BytesIO(body.encode("utf-8"))
        elif isinstance(body, bytes):
            return BytesIO(body)
        elif not isinstance(body, BufferedIOBase):
            type_ = type(body)
            raise ValidationException(
                f"Body provided is an unexpected type ({type_}). Request was "
                f"expecting bytes, str, or file-like body."
            )

        return body