def _byteify(data, ignore_dicts=False):
if isinstance(data, unicode):<EOL><INDENT>return data.encode("<STR_LIT:utf-8>")<EOL><DEDENT>if isinstance(data, list):<EOL><INDENT>return [_byteify(item, ignore_dicts=True) for item in data]<EOL><DEDENT>if isinstance(data, dict) and not ignore_dicts:<EOL><INDENT>return {<EOL>_byteify(key, ignore_dicts=True): _byteify(value, ignore_dicts=True)<EOL>for key, value in data.iteritems()<EOL>}<EOL><DEDENT>return data<EOL>
converts unicode to utf-8 when reading in json files