docs: def sort(self, cmp=None, key=None, reverse=False):
          """Sorts rows in the texttable.
  
      Args:
        cmp: func, non default sort algorithm to use.
        key: func, applied to each element before sorting.
        reverse: bool, reverse order of sort.
      """
  
          def _DefaultKey(value):
              """Default key func is to create a list of all fields."""
              result = []
              for key in self.header:
                  # Try sorting as numerical value if possible.
                  try:
                      result.append(float(value[key]))
                  except ValueError:
                      result.append(value[key])
              return result
  
          key = key or _DefaultKey
          # Exclude header by copying table.
          new_table = self._table[1:]
  
          if cmp is not None:
              key = cmp_to_key(cmp)
  
          new_table.sort(key=key, reverse=reverse)
  
          # Regenerate the table with original header
          self._table = [self.header]
          self._table.extend(new_table)
          # Re-write the 'row' attribute of each row
          for index, row in enumerate(self._table):
              row.row = index