(data, enc='utf8')
return data.encode(enc) if isinstance(data, unicode) else bytes(data)
Convert anything to bytes
Convert anything to bytes
Convert anything to bytes
def tob(data, enc='utf8'):
    """ Convert anything to bytes """
    return data.encode(enc) if isinstance(data, unicode) else bytes(data)
def tob ( data , enc = 'utf8' ) : return data . encode ( enc ) if isinstance ( data , unicode ) else bytes ( data )