code: def dict_to_table(header, contents):
      
      def to_text(row):
          name, value = row
          m = max_col1_size + 1 - len(name)
          spacing = ' ' * m
  
          return ''.join([name, spacing, value])
  
      thead = tuple(str(col) for col in header)
      rows = []
      for name, value in contents.items():
          # code highlighting
          if value != '':
              if isinstance(value, str):
                  value = "'{}'".format(value)
              value = ':py:`{}`'.format(value)
          rows.append((name, value))
  
      n = np.max([len(header[0])] +
                 [len(col1) for col1, _ in rows])
      hborder = tuple('='*n for col in header)
      rows = [hborder, thead, hborder] + rows + [hborder]
      max_col1_size = np.max([len(col1) for col1, _ in rows])
      table = '\n'.join([to_text(row) for row in rows])
      return table
docs: Convert dict to table
  
      Parameters
      ----------
      header : tuple
          Table header. Should have a length of 2.
      contents : dict
          The key becomes column 1 of table and the
          value becomes column 2 of table.