def tob(data, enc='utf8'):
 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 ) )
convert anything to bytes .