code: def task(self, name_or_class: Any) -> Task:
          '''Return a running Task object matching the given name or class.'''
  
          if name_or_class in self.all_tasks:
              return self.all_tasks[name_or_class]
  
          try:
              return self.all_tasks.get(name_or_class.__class__.__name__, None)
  
          except AttributeError:
              return Nonf task(self, name_or_class: Any) -> Task:
          '''Return a running Task object matching the given name or class.'''
  
          if name_or_class in self.all_tasks:
              return self.all_tasks[name_or_class]
  
          try:
              return self.all_tasks.get(name_or_class.__class__.__name__, None)
  
          except AttributeError:
              return None
docs: Return a running Task object matching the given name or class.