docs: def get_rlzs_assoc(cinfo, sm_lt_path=None, trts=None):
      """
      :param cinfo: a :class:`openquake.commonlib.source.CompositionInfo`
      :param sm_lt_path: logic tree path tuple used to select a source model
      :param trts: tectonic region types to accept
      """
      assoc = RlzsAssoc(cinfo)
      offset = 0
      trtset = set(cinfo.gsim_lt.values)
      for smodel in cinfo.source_models:
          # discard source models with non-acceptable lt_path
          if sm_lt_path and not accept_path(smodel.path, sm_lt_path):
              continue
  
          # collect the effective tectonic region types and ruptures
          trts_ = set()
          for sg in smodel.src_groups:
              if sg.eff_ruptures:
                  if (trts and sg.trt in trts) or not trts:
                      trts_.add(sg.trt)
  
          # recompute the GSIM logic tree if needed
          if trts_ != {'*'} and trtset != trts_:
              before = cinfo.gsim_lt.get_num_paths()
              gsim_lt = cinfo.gsim_lt.reduce(trts_)
              after = gsim_lt.get_num_paths()
              if sm_lt_path and before > after:
                  # print the warning only when saving the logic tree,
                  # i.e. when called with sm_lt_path in store_rlz_info
                  logging.warning('Reducing the logic tree of %s from %d to %d '
                                  'realizations', smodel.name, before, after)
              gsim_rlzs = list(gsim_lt)
              all_trts = list(gsim_lt.values)
          else:
              gsim_rlzs = list(cinfo.gsim_lt)
              all_trts = list(cinfo.gsim_lt.values)
  
          rlzs = cinfo._get_rlzs(smodel, gsim_rlzs, cinfo.seed + offset)
          assoc._add_realizations(offset, smodel, all_trts, rlzs)
          offset += len(rlzs)
  
      if assoc.realizations:
          assoc._init()
      return assoc