Return standardized format for lists/dictionaries.

    Lists of dictionaries are sorted by the value of the dictionary at
    its primary key ('id' or 'key'). OrderedDict's are converted to
    basic dictionaries.

def _standardize(structure):
    '''
    Return standardized format for lists/dictionaries.

    Lists of dictionaries are sorted by the value of the dictionary at
    its primary key ('id' or 'key'). OrderedDict's are converted to
    basic dictionaries.
    '''
    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