code: def set_algorithm_input(alg, inp, port=0):
      """Set the input to a vtkAlgorithm.
  
      Parameters
      ----------
      alg : vtk.vtkAlgorithm
          The algorithm whose input is being set.
  
      inp : vtk.vtkAlgorithm | vtk.vtkAlgorithmOutput | vtk.vtkDataObject
          The input to the algorithm.
  
      port : int, default: 0
          The input port.
  
      """
      if isinstance(inp, _vtk.vtkAlgorithm):
          alg.SetInputConnection(port, inp.GetOutputPort())
      elif isinstance(inp, _vtk.vtkAlgorithmOutput):
          alg.SetInputConnection(port, inp)
      else:
          alg.SetInputDataObject(port, inp)
  
imports: import traceback
  import numpy
  import pyvista
  from pyvista.core.errors import PyVistaPipelineError
  from pyvista.core.utilities.helpers import wrap
  from pyvista.plotting import _vtk
label_desc: Use image node_id 2 for calling a global function with example usage: set_algorithm_input(alg, inp, port) without return types