def u2str(data):
if isinstance(data, dict):<EOL><INDENT>return {u2str(k): u2str(v) for k, v in data.items()}<EOL><DEDENT>elif isinstance(data, list):<EOL><INDENT>return [u2str(x) for x in data]<EOL><DEDENT>elif isinstance(data, text_type):<EOL><INDENT>return data.encode('<STR_LIT:utf-8>')<EOL><DEDENT>else:<EOL><INDENT>return data<EOL><DEDENT>
Recursively converts unicode objects to UTF-8 encoded byte strings.