def _autobox(content, format):
if format == Format.JSON:<EOL><INDENT>return json.loads(content)<EOL><DEDENT>elif format == Format.XML:<EOL><INDENT>return etree.fromstring(content)<EOL><DEDENT>elif format == Format.CSV:<EOL><INDENT>try:<EOL><INDENT>return csv.reader(io.BytesIO(content))<EOL><DEDENT>except TypeError:<EOL><INDENT>def unicode_csv_reader(unicode_csv_data, dialect=csv.excel, **kwargs):<EOL><INDENT>csv_reader = csv.reader(utf_8_encoder(unicode_csv_data),<EOL>dialect=dialect, **kwargs)<EOL>for row in csv_reader:<EOL><INDENT>yield [unicode(cell, '<STR_LIT:utf-8>') for cell in row]<EOL><DEDENT><DEDENT>def utf_8_encoder(unicode_csv_data):<EOL><INDENT>for line in unicode_csv_data:<EOL><INDENT>yield line.encode('<STR_LIT:utf-8>')<EOL><DEDENT><DEDENT>return unicode_csv_reader(io.StringIO(content))<EOL><DEDENT><DEDENT>else:<EOL><INDENT>raise AutoboxError("<STR_LIT>" % format)<EOL><DEDENT>
Autobox response content.

:param content: Response content
:type content: str
:param format: Format to return
:type format: `yaxil.Format`
:returns: Autoboxed content
:rtype: dict|xml.etree.ElementTree.Element|csvreader