code: def count_sci_extensions(filename):
      
      num_sci = 0
      extname = 'SCI'
  
      hdu_list = fileutil.openImage(filename, memmap=False)
  
      for extn in hdu_list:
          if 'extname' in extn.header and extn.header['extname'] == extname:
              num_sci += 1
  
      if num_sci == 0:
          extname = 'PRIMARY'
          num_sci = 1
  
      hdu_list.close()
  
      return num_sci,extname
docs: Return the number of SCI extensions and the EXTNAME from a input MEF file.