def LabelValueTable(self, label_list=None):
    label_list = label_list or self._Header()[0]
    # Ensure all labels are valid.
    for label in label_list:
      if label not in self._Header():
        raise TableError('Invalid label prefix: %s.' % label)

    sorted_list = []
    for header in self._Header():
      if header in label_list:
        sorted_list.append(header)

    label_str = '# LABEL %s\n' % '.'.join(sorted_list)

    body = []
    for row in self:
    # Some of the row values are pulled into the label, stored in label_prefix.
      label_prefix = []
      value_list = []
      for key, value in row.items():
        if key in sorted_list:
          # Set prefix.
          label_prefix.append(value)
        else:
          value_list.append('%s %s' % (key, value))

      body.append(''.join(
          ['%s.%s\n' % ('.'.join(label_prefix), v) for v in value_list]))

    return '%s%s' % (label_str, ''.join(body))
Returns whole table as rows of name/value pairs.
dataset/ETHPy150Open google/textfsm/texttable.py/TextTable.LabelValueTable