def _dtype_to_recformat(dtype):
 if (not isinstance(dtype, np.dtype)):
  dtype = np.dtype(dtype)
 kind = dtype.base.kind
 if (kind in ('U', 'S')):
  recformat = kind = 'a'
 else:
  itemsize = dtype.base.itemsize
  recformat = (kind + str(itemsize))
 return (recformat, kind, dtype)

def _dtype_to_recformat ( dtype ) : if ( not isinstance ( dtype , np . dtype ) ) : dtype = np . dtype ( dtype ) kind = dtype . base . kind if ( kind in ( 'U' , 'S' ) ) : recformat = kind = 'a' else : itemsize = dtype . base . itemsize recformat = ( kind + str ( itemsize ) ) return ( recformat , kind , dtype )
utility function for converting a dtype object or string that instantiates a dtype into one of the two character numpy format codes that have been traditionally used by pyfits .