def _traverse_results(value, fields, row, path):
 for (f, v) in value.iteritems():
  field_name = ('{path}.{name}'.format(path=path, name=f) if path else f)
  if (not isinstance(v, (dict, list, tuple))):
   if (field_name in fields):
    row[fields.index(field_name)] = ensure_utf(v)
  elif (isinstance(v, dict) and (f != 'attributes')):
   _traverse_results(v, fields, row, field_name)

def _traverse_results ( value , fields , row , path ) : for ( f , v ) in value . iteritems ( ) : field_name = ( '{path}.{name}' . format ( path = path , name = f ) if path else f ) if ( not isinstance ( v , ( dict , list , tuple ) ) ) : if ( field_name in fields ) : row [ fields . index ( field_name ) ] = ensure_utf ( v ) elif ( isinstance ( v , dict ) and ( f != 'attributes' ) ) : _traverse_results ( v , fields , row , field_name )
helper method for parse_results() .