def to_bytes(s):  
if isinstance(s, bytes):<EOL><INDENT>return s<EOL><DEDENT>if isinstance(s, str) or is_unicode(s):<EOL><INDENT>return s.encode("<STR_LIT:utf-8>")<EOL><DEDENT>try:<EOL><INDENT>return unicode(s).encode("<STR_LIT:utf-8>")<EOL><DEDENT>except NameError:<EOL><INDENT>return str(s).encode("<STR_LIT:utf-8>")<EOL><DEDENT>
Convert an item into bytes.