def dict_to_paths(dict_):
    """Convert a dict to metric paths.

    >>> dict_to_paths({'foo': {'bar': 1}, 'baz': 2})
    {
        'foo.bar': 1,
        'baz': 2,
    }
    """
    metrics = {}
    for k, v in dict_.items():
        if isinstance(v, dict):
            submetrics = dict_to_paths(v)
            for subk, subv in submetrics.items():
                metrics['.'.join([str(k), str(subk)])] = subv
        else:
            metrics[k] = v
    return metrics