docs: def get_class_name_from_frame(fr: FrameType) -> Optional[str]:
      """
      A frame contains information about a specific call in the Python call
      stack; see https://docs.python.org/3/library/inspect.html.
  
      If the call was to a member function of a class, this function attempts
      to read the class's name. It returns ``None`` otherwise.
      """
      # http://stackoverflow.com/questions/2203424/python-how-to-retrieve-class-information-from-a-frame-object  # noqa
      args, _, _, value_dict = inspect.getargvalues(fr)
      # we check the first parameter for the frame function is named 'self'
      if len(args) and args[0] == 'self':
          # in that case, 'self' will be referenced in value_dict
          instance = value_dict.get('self', None)
          if instance:
              # return its class
              cls = getattr(instance, '__class__', None)
              if cls:
                  return cls.__name__
              return None
      # return None otherwise
      return None