def flatten(alist):
    rv = []
    for val in alist:
        if isinstance(val, list):
            rv.extend(flatten(val))
        else:
            rv.append(val)
    return rv
Creates a dict of dictionaries suitable for passing to the
dataset/ETHPy150Open kdart/pycopia/aid/pycopia/aid.py/flatten--crossover with--dataset/ETHPy150Open inonit/drf-haystack/drf_haystack/filters.py/HaystackFacetFilter.build_facet_filter