import collections


def convert_defaultdict_to_regular_dict(inputdict: dict):
    """
    Recursively convert defaultdict to dict.
    """
    if isinstance(inputdict, collections.defaultdict):
        inputdict = {
            key: convert_defaultdict_to_regular_dict(value)
            for key, value in inputdict.items()
        }
    return inputdict