cypy/compat.py
def bstr(value, encoding="utf-8"):
        """ Convert a value to byte string, held in a Python `bytearray` object.
        """
        if isinstance(value, bytearray):
            return value
        elif isinstance(value, bytes):
            return bytearray(value)
        elif isinstance(value, unicode):
            return bytearray(value.encode(encoding=encoding))
        else:
            try:
                return bytearray(value.__bytes__())
            except AttributeError:
                return bytearray(unicode(value).encode(encoding=encoding))
 Convert a value to byte string, held in a Python `bytearray` object.
        
Convert a value to byte string, held in a Python `bytearray` object.
Convert a value to byte string held in a Python ` bytearray ` object .
def bstr(value, encoding="utf-8"):
        if isinstance(value, bytearray):
            return value
        elif isinstance(value, bytes):
            return bytearray(value)
        elif isinstance(value, unicode):
            return bytearray(value.encode(encoding=encoding))
        else:
            try:
                return bytearray(value.__bytes__())
            except AttributeError:
                return bytearray(unicode(value).encode(encoding=encoding))
def bstr ( value , encoding = "utf-8" ) : if isinstance ( value , bytearray ) : return value elif isinstance ( value , bytes ) : return bytearray ( value ) elif isinstance ( value , unicode ) : return bytearray ( value . encode ( encoding = encoding ) ) else : try : return bytearray ( value . __bytes__ ( ) ) except AttributeError : return bytearray ( unicode ( value ) . encode ( encoding = encoding ) )
Convert a value to byte string, held in a Python `bytearray` object.
Convert a value to byte string held in a Python ` bytearray ` object .
""" Convert a value to byte string, held in a Python `bytearray` object.
        """
value
encoding