def _standardize(structure):
 def mutating_helper(structure):
  if isinstance(structure, list):
   structure.sort(key=_id_or_key)
   for each in structure:
    mutating_helper(each)
  elif isinstance(structure, dict):
   structure = dict(structure)
   for (k, v) in six.iteritems(structure):
    mutating_helper(k)
    mutating_helper(v)
 new_structure = copy.deepcopy(structure)
 mutating_helper(new_structure)
 return new_structure

def _standardize ( structure ) : def mutating_helper ( structure ) : if isinstance ( structure , list ) : structure . sort ( key = _id_or_key ) for each in structure : mutating_helper ( each ) elif isinstance ( structure , dict ) : structure = dict ( structure ) for ( k , v ) in six . iteritems ( structure ) : mutating_helper ( k ) mutating_helper ( v ) new_structure = copy . deepcopy ( structure ) mutating_helper ( new_structure ) return new_structure
return standardized format for lists/dictionaries .