def _SplitLabels(labels):
  """Parse the 'labels' key from a PerfKitBenchmarker record.

  Labels are recorded in '|key:value|,|key:value|' form.
  This function transforms them to a dict.

  Args:
    labels: string. labels to parse.

  Returns:
    dict. Parsed 'labels'.
  """
  result = {}
  for item in labels.strip('|').split('|,|'):
    k, v = item.split(':', 1)
    result[k] = v
  return result