code: def _visit_or_none(node, attr, visitor, parent, visit="visit", **kws):
      
      value = getattr(node, attr, None)
      if value:
          return getattr(visitor, visit)(value, parent, **kws)
  
      return None
docs: If the given node has an attribute, visits the attribute, and
      otherwise returns None.