docs: def _npy_string2fits(d, table_type='binary'):
      """
      d is the full element from the descr
  
      form for strings is the total number of bytes followed by A.  Thus
      for vector or array columns it is the size of the string times the
      total number of elements in the array.
  
      Then the dim is set to
          (sizeofeachstring, 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' and npy_dtype[0] != 'U':
          raise ValueError("expected S or U type, got %s" % npy_dtype[0])
  
      # get the size of each string
      string_size_str = npy_dtype[1:]
      string_size = int(string_size_str)
  
      if string_size <= 0:
          raise ValueError('string sizes must be > 0, '
                           'got %s for field %s' % (npy_dtype, name))
  
      # now the dimensions
      if len(d) == 2:
          if table_type == 'ascii':
              form = 'A'+string_size_str
          else:
              form = string_size_str+'A'
      else:
          if table_type == 'ascii':
              raise ValueError(
                  "Ascii table columns must be scalar, got %s" % str(d))
          if isinstance(d[2], tuple):
              # this is an array column.  the form
              # should be total elements followed by A
              # count = 1
              # count = [count*el for el in d[2]]
              count = reduce(lambda x, y: x*y, d[2])
              count = string_size*count
              form = '%dA' % count
  
              # will have to do tests to see if this is the right order
              dim = list(reversed(d[2]))
              # dim = d[2]
              dim = [string_size_str] + [str(e) for e in dim]
              dim = '(' + ','.join(dim)+')'
          else:
              # this is a vector (1d array) column
              count = string_size*d[2]
              form = '%dA' % count
  
              # will have to do tests to see if this is the right order
              dim = [string_size_str, str(d[2])]
              dim = '(' + ','.join(dim)+')'
  
      return name, form, dim