code: def strip_tree(node,
                 # Runtime optimization
                 iter_node=iter_node, special=ast.AST,
                 list=list, isinstance=isinstance, type=type, len=len):
      
      stripped = set()
  
      def strip(node, indent):
          unknown = set()
          leaf = True
          for subnode, _ in iter_node(node, unknown=unknown):
              leaf = False
              strip(subnode, indent + '    ')
          if leaf:
              if isinstance(node, special):
                  unknown = set(vars(node))
          stripped.update(unknown)
          for name in unknown:
              delattr(node, name)
          if hasattr(node, 'ctx'):
              delattr(node, 'ctx')
              if 'ctx' in node._fields:
                  mylist = list(node._fields)
                  mylist.remove('ctx')
                  node._fields = mylist
      strip(node, '')
      return stripped
docs: Strips an AST by removing all attributes not in _fields.
  
      Returns a set of the names of all attributes stripped.
  
      This canonicalizes two trees for comparison purposes.