def unravel_dicts(indict):
    """Unravels encapsulated dictionaries stemming from class-subclass structures"""
    resolved = False
    dictchain = [indict]
    keychain = ['']
    i = 0
    while not resolved or i > 0:
        resolved = True
        keypop = []
        for key in dictchain[i].keys():
            if isinstance(dictchain[i][key], dict):
                dictchain.append(dictchain[i][key])
                keychain.append(key)
                keypop.append(key)
                resolved = False
        for key in keypop:
            dictchain[i].pop(key)
        if not resolved:
            i += 1
        else:
            i -= 1
    outdict = {}
    for i, j in zip(keychain, dictchain):
        outdict[i] = j
    return outdict
