docs: def set_risk_imtls(self, risk_models):
          """
          :param risk_models:
              a dictionary taxonomy -> loss_type -> risk_function
  
          Set the attribute risk_imtls.
          """
          # NB: different loss types may have different IMLs for the same IMT
          # in that case we merge the IMLs
          imtls = {}
          for taxonomy, risk_functions in risk_models.items():
              for risk_type, rf in risk_functions.items():
                  imt = rf.imt
                  from_string(imt)  # make sure it is a valid IMT
                  imls = list(rf.imls)
                  if imt in imtls and imtls[imt] != imls:
                      logging.debug(
                          'Different levels for IMT %s: got %s, expected %s',
                          imt, imls, imtls[imt])
                      imtls[imt] = sorted(set(imls + imtls[imt]))
                  else:
                      imtls[imt] = imls
          self.risk_imtls = imtls
          if self.uniform_hazard_spectra:
              self.check_uniform_hazard_spectra()