class_docstr: Event aggregation object.
      
class_docstr_tok: ["Event","aggregation","object","."]
docstr: Source: https://stackoverflow.com/a/25959545
docstr_tok: ["Source",":","https",":","\/\/stackoverflow.com\/a\/25959545"]
code: def _get_class_that_defined_method(method):
      """Source: https://stackoverflow.com/a/25959545"""
      if inspect.ismethod(method):
          for cls in inspect.getmro(method.__self__.__class__):
              if cls.__dict__.get(method.__name__) is method:
                  return cls
          method = method.__func__  # fallback to __qualname__ parsing
      if inspect.isfunction(method):
          cls = getattr(
              inspect.getmodule(method),
              method.__qualname__.split(".<locals>", 1)[0].rsplit(
                  ".", 1
              )[0],
          )
          if isinstance(cls, type):
              return cls
      return getattr(method, "__objclass__", None)
  
file_path: maze/maze/core/events/pubsub.py
imports: import inspect
  from abc import ABC, abstractmethod
  from typing import Callable, List, Iterable, Dict, Union, Type, TypeVar
  from maze.core.events.event_collection import EventCollection
  from maze.core.events.event_service import EventScope, EventRecord, EventService
label_desc: Use image node_id 6 for calling the Subscriber obj's underlying member method code with example usage: obj._get_class_that_defined_method(method) and returns: getattr, cls, cls