def getheader(filename, *args, **kwargs):
 (mode, closed) = _get_file_mode(filename)
 (hdulist, extidx) = _getext(filename, mode, *args, **kwargs)
 try:
  hdu = hdulist[extidx]
  header = hdu.header
 finally:
  hdulist._close(closed=closed)
 return header

def getheader ( filename , * args , ** kwargs ) : ( mode , closed ) = _get_file_mode ( filename ) ( hdulist , extidx ) = _getext ( filename , mode , * args , ** kwargs ) try : hdu = hdulist [ extidx ] header = hdu . header finally : hdulist . _close ( closed = closed ) return header
get the header from an extension of a fits file .