docs: def _npy_num2fits(d, table_type='binary', write_bitcols=False):
      """
      d is the full element from the descr
  
      For vector,array columns the form is the total counts
      followed by the code.
  
      For array columns with dimension greater than 1, the dim is set to
          (dim1, dim2, ...)
      So it is treated like an extra dimension
  
      """
  
      dim = None
  
      name = d[0]
  
      npy_dtype = d[1][1:]
      if npy_dtype[0] == 'S' or npy_dtype[0] == 'U':
          raise ValueError("got S or U type: use _npy_string2fits")
  
      if npy_dtype not in _table_npy2fits_form:
          raise ValueError("unsupported type '%s'" % npy_dtype)
  
      if table_type == 'binary':
          form = _table_npy2fits_form[npy_dtype]
      else:
          form = _table_npy2fits_form_ascii[npy_dtype]
  
      # now the dimensions
      if len(d) > 2:
          if table_type == 'ascii':
              raise ValueError(
                  "Ascii table columns must be scalar, got %s" % str(d))
  
          if write_bitcols and npy_dtype == 'b1':
              # multi-dimensional boolean
              form = 'X'
  
          # Note, depending on numpy version, even 1-d can be a tuple
          if isinstance(d[2], tuple):
              count = reduce(lambda x, y: x*y, d[2])
              form = '%d%s' % (count, form)
  
              if len(d[2]) > 1:
                  # this is multi-dimensional array column.  the form
                  # should be total elements followed by A
                  dim = list(reversed(d[2]))
                  dim = [str(e) for e in dim]
                  dim = '(' + ','.join(dim)+')'
          else:
              # this is a vector (1d array) column
              count = d[2]
              form = '%d%s' % (count, form)
  
      return name, form, dim