code: def _find_input_and_output_nodes(nodes: List[Node]):
      """
      Find the input and output node names which are not found in the given list of nodes.
      """
      input_nodes = []
      output_nodes = []
  
      # if a node has an input node which is not in the node list
      # we treat that input node as the input of the checkpoint function
      for node in nodes:
          for input_node in node._input_nodes.keys():
              node_repr = repr(input_node)
              if (
                  input_node not in nodes
                  and node_repr not in input_nodes
              ):
                  input_nodes.append(node_repr)
  
      # if a node has a user node which is not in the node list
      # we treat that user node as the node receiving the current node output
      for node in nodes:
          for output_node in node.users.keys():
              node_repr = repr(node)
              if (
                  output_node not in nodes
                  and node_repr not in output_nodes
              ):
                  output_nodes.append(node_repr)
  
      return input_nodes, output_nodes
  
file_path: colossalai/colossalai/fx/codegen/activation_checkpoint_codegen.py
imports: from typing import Any, Dict, Iterable, List, Tuple
  import torch
  import colossalai
label_desc: Use image node_id 4 for calling a global function with example usage: _find_input_and_output_nodes(nodes) and returns: input_nodes,  output_nodes