code: def mmap_key(metric_name, name, labelnames, labelvalues):
      
      # ensure labels are in consistent order for identity
      labels = dict(zip(labelnames, labelvalues))
      return json.dumps([metric_name, name, labels], sort_keys=True)
docs: Format a key for use in the mmap file.