def to_bytes(text, encoding='<STR_LIT:utf-8>'):
if not text:<EOL><INDENT>return text<EOL><DEDENT>if not isinstance(text, bytes_type):<EOL><INDENT>text = text.encode(encoding)<EOL><DEDENT>return text<EOL>
Make sure text is bytes type.