<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def time_to_run(self, class_, time_):
 """return true if it's time to run the job. This is true if there is no previous information about its last run or if the last time it ran and set its next_run to a date that is now past. """

        app_name = class_.app_name
        try:
            info = self.job_state_database[app_name]
        except KeyError:
            if time_:
                h, m = [int(x) for x in time_.split(':')]
                # only run if this hour and minute is < now
                now = utc_now()
                if now.hour > h:
                    return True
                elif now.hour == h and now.minute >= m:
                    return True
                return False
            else:
                # no past information, run now
                return True
        next_run = info['next_run']

        if not next_run:
            # It has never run before.
            # If it has an active ongoing status it means two
            # independent threads tried to start it. The second one
            # (by a tiny time margin) will have a job_class whose
            # `ongoing` value has already been set.
            # If that's the case, let it through because it will
            # commence and break due to RowLevelLockError in the
            # state's __setitem__ method.
            return bool(info['ongoing'])

        if next_run < utc_now():
            return True
        return False