code: def node_sample(
      inputs: NodeSamplerInput,
      sample_fn: Callable,
  ) -> Union[SamplerOutput, HeteroSamplerOutput]:
      r"""Performs sampling from a :class:`NodeSamplerInput`, leveraging a
      sampling function that accepts a seed and (optionally) a seed time as
      input. Returns the output of this sampling procedure.
      """
      if inputs.input_type is not None:  # Heterogeneous sampling:
          seed = {inputs.input_type: inputs.node}
          seed_time = None
          if inputs.time is not None:
              seed_time = {inputs.input_type: inputs.time}
      else:  # Homogeneous sampling:
          seed = inputs.node
          seed_time = inputs.time
  
      out = sample_fn(seed, seed_time)
      out.metadata = (inputs.input_id, inputs.time)
  
      return out
  
imports: import copy
  import math
  import sys
  import warnings
  from typing import Callable, Dict, List, Optional, Tuple, Union
  import torch
  from torch import Tensor
  import torch_geometric.typing
  from torch_geometric.data import Data, FeatureStore, GraphStore, HeteroData, remote_backend_utils
  from torch_geometric.data.graph_store import EdgeLayout
  from torch_geometric.sampler import BaseSampler, EdgeSamplerInput, HeteroSamplerOutput, NegativeSampling, NodeSamplerInput, SamplerOutput
  from torch_geometric.sampler.base import DataType, NumNeighbors, SubgraphType
  from torch_geometric.sampler.utils import remap_keys, to_csc, to_hetero_csc
  from torch_geometric.typing import EdgeType, NodeType, OptTensor
label_desc: Use image node_id 1 for calling a global function with example usage: node_sample(inputs, sample_fn) and returns: out