code: def get_visit_fn(cls, kind, is_leaving=False) -> Callable:
          
          method = "leave" if is_leaving else "enter"
          visit_fn = getattr(cls, f"{method}_{kind}", None)
          if not visit_fn:
              visit_fn = getattr(cls, method, None)
          return visit_fn
docs: Get the visit function for the given node kind and direction.