def _fix_unflatten_list(d):
    if hasattr(d, 'keys'):
        for k in list(d.keys()):
            d[k] = _fix_unflatten_list(d[k])
        if (('0' in d) and (str((len(d) - 1)) in d)):
            r = []
            for i in range(len(d)):
                k = str(i)
                if (k not in d):
                    return d
                r.append(d[k])
            return r
    return d
def _fix_unflatten_list(d):
    if hasattr(d, 'keys'):
        for k in list(d.keys()):
            d[k] = _fix_unflatten_list(d[k])
        if (('0' in d) and (str((len(d) - 1)) in d)):
            r = []
            for i in range(len(d)):
                k = str(i)
                if (k not in d):
                    return d
                r.append(d[k])
            return r
    return d