def METHOD_NAME(obj):
    """
    Recursively sort list or dict nested lists. Taken from
    https://stackoverflow.com/questions/18464095/how-to-achieve-assertdictequal-with-assertsequenceequal-applied-to-values
    """
    if isinstance(obj, dict):
        _sorted = {}
        for key in sorted(obj):
            _sorted[key] = METHOD_NAME(obj[key])
    elif isinstance(obj, list):
        new_list = []
        for val in obj:
            new_list.append(METHOD_NAME(val))
        try:
            _sorted = sorted(new_list, key=itemgetter("tileid"))
        except:
            _sorted = new_list
    else:
        _sorted = obj
    return _sorted