code: def find_and_read_ebins(hdulist):
      
      from fermipy import utils
      ebins = None
      if 'ENERGIES' in hdulist:
          hdu = hdulist['ENERGIES']
          ectr = hdu.data.field(hdu.columns[0].name)
          ebins = np.exp(utils.center_to_edge(np.log(ectr)))
      elif 'EBOUNDS' in hdulist:
          hdu = hdulist['EBOUNDS']
          emin = hdu.data.field('E_MIN') / 1E3
          emax = hdu.data.field('E_MAX') / 1E3
          ebins = np.append(emin, emax[-1])
      return ebins
docs: Reads and returns the energy bin edges.
  
      This works for both the CASE where the energies are in the ENERGIES HDU
      and the case where they are in the EBOUND HDU