code: def from_data(data):
      
      if len(data) == 0:  # pragma: no cover
          return None
      else:
          ptable = PrettyTable()
          ptable.field_names = data[0].keys()
          for row in data:
              ptable.add_row(row)
          return ptable
docs: Construct a Prettytable from list of rows.