<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def is_valid_intensity_measure_levels(self):
 """ In order to compute hazard curves, `intensity_measure_types_and_levels` must be set or extracted from the risk models. """

        invalid = self.no_imls() and not self.risk_files and (
            self.hazard_curves_from_gmfs or self.calculation_mode in
            ('classical', 'disaggregation'))
        return not invalid