def _unpack_batch_response(response, content):
 parser = Parser()
 message = _generate_faux_mime_message(parser, response, content)
 if (not isinstance(message._payload, list)):
  raise ValueError('Bad response:  not multi-part')
 for subrequest in message._payload:
  (status_line, rest) = subrequest._payload.split('\n', 1)
  (_, status, _) = status_line.split(' ', 2)
  sub_message = parser.parsestr(rest)
  payload = sub_message._payload
  ctype = sub_message['Content-Type']
  msg_headers = dict(sub_message._headers)
  msg_headers['status'] = status
  headers = httplib2.Response(msg_headers)
  if (ctype and ctype.startswith('application/json')):
   payload = json.loads(payload)
  (yield (headers, payload))

def _unpack_batch_response ( response , content ) : parser = Parser ( ) message = _generate_faux_mime_message ( parser , response , content ) if ( not isinstance ( message . _payload , list ) ) : raise ValueError ( 'Bad response:  not multi-part' ) for subrequest in message . _payload : ( status_line , rest ) = subrequest . _payload . split ( '\n' , 1 ) ( _ , status , _ ) = status_line . split ( ' ' , 2 ) sub_message = parser . parsestr ( rest ) payload = sub_message . _payload ctype = sub_message [ 'Content-Type' ] msg_headers = dict ( sub_message . _headers ) msg_headers [ 'status' ] = status headers = httplib2 . Response ( msg_headers ) if ( ctype and ctype . startswith ( 'application/json' ) ) : payload = json . loads ( payload ) ( yield ( headers , payload ) )
convert response .