def flatten_dict(d: dict):

    """Flattens dictionary with subdictionaries.

    Arguments:
        d {dict} -- Dict to flatten

    Returns:
        flattened {dict} -- Flattened dict
    """

    def items():
        for key, value in d.items():
            if isinstance(value, dict):
                for subkey, subvalue in flatten_dict(value).items():
                    yield key + "." + subkey, subvalue
            else:
                yield key, value

    flattened = dict(items())

    return flattened