def METHOD_NAME(self, status_list, msg=None):
    if isinstance(status_list, str):
        status_list = [status_list]
    if self.status in status_list:
        # include corner cases in is_successful logic
        if 'successful' not in status_list or self.is_successful:
            return
    if msg is None:
        msg = ''
    else:
        msg += '\n'
    msg += '{0}-{1} has status of {2}, which is not in {3}.'.format(self.type.title(), self.id, self.status, status_list)
    if getattr(self, 'execution_environment', ''):
        msg += '\nexecution_environment: {}'.format(bytes_to_str(self.execution_environment))
        if getattr(self, 'related', False):
            ee = self.related.execution_environment.get()
            msg += f'\nee_image: {ee.image}'
            msg += f'\nee_credential: {ee.credential}'
            msg += f'\nee_pull_option: {ee.pull}'
            msg += f'\nee_summary_fields: {ee.summary_fields}'
    msg += self.failure_output_details()
    if getattr(self, 'job_explanation', '').startswith('Previous Task Failed'):
        try:
            data = json.loads(self.job_explanation.replace('Previous Task Failed: ', ''))
            dependency = self.walk('/api/v2/{0}s/{1}/'.format(data['job_type'], data['job_id']))
            if hasattr(dependency, 'failure_output_details'):
                msg += '\nDependency output:\n{}'.format(dependency.failure_output_details())
            else:
                msg += '\nDependency info:\n{}'.format(dependency)
        except Exception as e:
            msg += '\nFailed to obtain dependency stdout: {}'.format(e)
    msg += '\nTIME WHEN STATUS WAS FOUND: {} (UTC)\n'.format(datetime.utcnow())
    raise AssertionError(msg)