def encode_unicode_bytes(my_string):
if not isinstance(my_string, basestring):<EOL><INDENT>my_string = repr(my_string)<EOL><DEDENT>if PYTHON_MAJOR_VERSION == <NUM_LIT:2>:<EOL><INDENT>if isinstance(my_string, str):<EOL><INDENT>return my_string<EOL><DEDENT>elif isinstance(my_string, unicode):<EOL><INDENT>return my_string.encode('<STR_LIT:utf-8>')<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if isinstance(my_string, str):<EOL><INDENT>return my_string.encode('<STR_LIT:utf-8>')<EOL><DEDENT>elif isinstance(my_string, bytes):<EOL><INDENT>return my_string<EOL><DEDENT><DEDENT>
Shim function, converts Unicode to UTF-8 encoded bytes regardless of the source format
        Intended for python 3 compatibility mode, and b/c PyCurl only takes raw bytes