code: def _calculate_optimal_column_widths(self):
          
          columns = len(self.data[0])  # number of columns
          str_labels = [parse_colorama(str(l)) for l in
                        self.labels]  # labels as strings
          str_data = [[parse_colorama(str(col)) for col in row] for row in
                      self.data]
          # values as strings
  
          widths = [0] * columns  # length of longest string in each column
          for row in str_data:  # calculate max width in each column
              widths = [max(w, len(c)) for w, c in zip(widths, row)]
  
          # check if label name is longer than data
          for col, label in enumerate(str_labels):
              if len(label) > widths[col]:
                  widths[col] = len(label)
  
          self.widths = widths
docs: Calculates widths of columns
  
          :return: Length of longest data in each column (labels and data)