code: def get_funcname(name, node):
      # type: (Leaf, Node) -> Text
      
      funcname = name.value
      if node.parent and node.parent.parent:
          grand = node.parent.parent
          if grand.type == syms.classdef:
              grandname = grand.children[1]
              assert grandname.type == token.NAME, repr(name)
              assert isinstance(grandname, Leaf)  # Same as previous, for mypy
              funcname = grandname.value + '.' + funcname
      return funcname
docs: Get function name by the following rules:
  
      - function -> function_name
      - instance method -> ClassName.function_name