docs: def get_function_name_from_frame(frame):
      # type: (Any) -> str
      """
      Heuristic to find the class-specified name by @guido
  
      For instance methods we return "ClassName.method_name"
      For functions we return "function_name"
      """
  
      def bases_to_mro(cls, bases):
          # type: (type, List[type]) -> List[type]
          """
          Convert __bases__ to __mro__
          """
          mro = [cls]
          for base in bases:
              if base not in mro:
                  mro.append(base)
              sub_bases = getattr(base, '__bases__', None)
              if sub_bases:
                  sub_bases = [sb for sb in sub_bases if sb not in mro and sb not in bases]
                  if sub_bases:
                      mro.extend(bases_to_mro(base, sub_bases))
          return mro
  
      code = frame.f_code
      # This ought to be aggressively cached with the code object as key.
      funcname = code.co_name
      if code.co_varnames:
          varname = code.co_varnames[0]
          if varname == 'self':
              inst = frame.f_locals.get(varname)
              if inst is not None:
                  try:
                      mro = inst.__class__.__mro__
                  except AttributeError:
                      mro = None
                      try:
                          bases = inst.__class__.__bases__
                      except AttributeError:
                          bases = None
                      else:
                          mro = bases_to_mro(inst.__class__, bases)
                  if mro:
                      for cls in mro:
                          bare_method = cls.__dict__.get(funcname)
                          if bare_method and getattr(bare_method, '__code__', None) is code:
                              return '%s.%s' % (cls.__name__, funcname)
      return funcname