class_docstr: Walks the abstract syntax tree and allows modifications of nodes.
  
  The `NodeTransformer` will walk the AST and use the return value of the
  visitor functions to replace or remove the old node.  If the return
  value of the visitor function is `None` the node will be removed
  from the previous location otherwise it's replaced with the return
  value.  The return value may be the original node in which case no
  replacement takes place.
code: def generic_visit(self, node, *args, **kwargs):
      for field, old_value in node.iter_fields():
          if isinstance(old_value, list):
              new_values = []
              for value in old_value:
                  if isinstance(value, Node):
                      value = self.visit(value, *args, **kwargs)
                      if value is None:
                          continue
                      elif not isinstance(value, Node):
                          new_values.extend(value)
                          continue
                  new_values.append(value)
              old_value[:] = new_values
          elif isinstance(old_value, Node):
              new_node = self.visit(old_value, *args, **kwargs)
              if new_node is None:
                  delattr(node, field)
              else:
                  setattr(node, field, new_node)
      return node
  
file_path: catboost/contrib/python/Jinja2/py2/jinja2/visitor.py
imports: from .nodes import Node
label_desc: Use image node_id 1 for calling the NodeTransformer obj's underlying member method code with example usage: obj.generic_visit(node) and returns: node