code: def dict_to_paths(dict_):
      
      metrics = {}
      for k, v in dict_.iteritems():
          if isinstance(v, dict):
              submetrics = dict_to_paths(v)
              for subk, subv in submetrics.iteritems():
                  metrics['.'.join([str(k), str(subk)])] = subv
          else:
              metrics[k] = v
      return metrics
docs: Convert a dict to metric paths.
  
      >>> dict_to_paths({'foo': {'bar': 1}, 'baz': 2})
      {
          'foo.bar': 1,
          'baz': 2,
      }