def flatten(dictionary, delim='.'):
    """Depth first redundantly flatten a nested dictionary.

    Arguments
    ---------
    dictionary : dict
        The dictionary to traverse and linearize.

    delim : str, default='.'
        The delimiter used to indicate nested keys.
    """
    out = dict()
    for key in dictionary:
        value = dictionary[key]
        if isinstance(value, dict):
            nested = flatten(value, delim=delim)
            out.update((key + delim + k, val) for k, val in nested.items())

        else:
            out[key] = value

    return out