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