code: def _influence_route_to_helpers(
      influence_instance: Union[
          "TracInCPBase", "InfluenceFunctionBase"
      ],
      inputs: Union[Tuple[Any, ...], DataLoader],
      k: Optional[int] = None,
      proponents: bool = True,
      **kwargs,
  ) -> Union[Tensor, KMostInfluentialResults]:
      """
      This is a helper function called by `TracInCPBase` and `InfluenceFunctionBase`
      implementations. Those methods share a common logic in that they assume
      an instance of their respective classes implement 2 private methods
      (``_influence`, `_get_k_most_influential`), and the logic of
      which private method to call is common, as described in the documentation of the
      `influence` method. The arguments and return values of this function are the exact
      same as the `influence` method. Note that `influence_instance` refers to the
      instance for which the `influence` method was called.
      """
      if k is None:
          return influence_instance._influence(inputs, **kwargs)
      else:
          return influence_instance._get_k_most_influential(
              inputs,
              k,
              proponents,
              **kwargs,
          )
  
imports: import warnings
  from functools import reduce
  from typing import Any, Callable, Iterable, List, NamedTuple, Optional, Tuple, TYPE_CHECKING, Union
  import torch
  import torch.nn
  from captum._utils.common import _get_module_from_name, _parse_version
  from captum._utils.gradient import _compute_jacobian_wrt_params, _compute_jacobian_wrt_params_with_sample_wise_trick
  from captum._utils.progress import progress
  from torch import Tensor
  from torch.nn import Module
  from torch.utils.data import DataLoader, Dataset
label_desc: Use image node_id 19 for calling a global function with example usage: _influence_route_to_helpers(influence_instance, inputs, k, proponents) and returns: influence_instance, influence_instance