code: def sort(self, fieldname, key=lambda x: x, desc=False, inplace=False):
          
          try:
              field_index = tuple(self.fields).index(fieldname)
          except ValueError:
              raise ValueError("Sorting on a field that doesn't exist: `%s`" %
                               fieldname)
  
          data_cols = izip(*sorted(izip(*[self.__data[field]
                                          for field in self.fields]),
                                   key=lambda row: key(row[field_index]),
                                   reverse=desc))
  
          target_table = self if inplace else DataTable()
  
          for field, data_col in izip(self.fields, data_cols):
              target_table[field] = list(data_col)
  
          # Note that sorting in-place still returns a reference
          # to the table being sorted, for convenience.
          return target_table
docs: This matches Python's built-in sorting signature closely.
  
          By default, a new DataTable will be returned and the original will
          not be mutated. If preferred, specify `inplace=True` in order to
          mutate the original table. Either way, a reference to the relevant
          table will be returned.