code: def get_hdf_injtype(sim_file):
      
      with h5py.File(sim_file, 'r') as fp:
          try:
              ftype = fp.attrs['injtype']
          except KeyError:
              ftype = CBCHDFInjectionSet.injtype
      return hdfinjtypes[ftype]
docs: Gets the HDFInjectionSet class to use with the given file.
  
      This looks for the ``injtype`` in the given file's top level ``attrs``. If
      that attribute isn't set, will default to :py:class:`CBCHDFInjectionSet`.
  
      Parameters
      ----------
      sim_file : str
          Name of the file. The file must already exist.
  
      Returns
      -------
      HDFInjectionSet :
          The type of HDFInjectionSet to use.