code: def add_task(cls, task, frequency=None):
          
          with cls._lock:
              if not isinstance(task, Task):
                  t = Task(name=task.__name__, frequency=frequency)
                  t.execute, task = task, t
  
              if frequency:
                  task.frequency = frequency
  
              cls.tasks.append(task)
              cls.tasks.sort()
docs: :param Task|callable task: Add 'task' to the list of tasks to run periodically
          :param int|float|None frequency: Frequency at which to execute the task