def METHOD_NAME(d):
    flat = dict(d)
    for key, value in d.items():
        if isinstance(value, dict):
            flattened = METHOD_NAME(value)
            flat.update({"%s.%s" % (key, k): v for k, v in flattened.items()})
        else:
            flat[key] = value
    return flat