def ub_to_str(string):
if not isinstance(string, str):<EOL><INDENT>if six.PY2:<EOL><INDENT>return str(string)<EOL><DEDENT>else:<EOL><INDENT>return string.decode()<EOL><DEDENT><DEDENT>return string<EOL>
converts py2 unicode / py3 bytestring into str
Args:
    string (unicode, byte_string): string to be converted

Returns:
    (str)