def METHOD_NAME(d, parent_key='', sep='.'):
    items = []
    for k, v in d.items():
        new_key = parent_key + sep + k if parent_key else k
        if isinstance(v, collections.MutableMapping):
            items.extend(METHOD_NAME(v, new_key).items())
        else:
            items.append((new_key, v))
    return dict(items)