code: def warn_or_raise(msg: str, raise_on_error: bool = True) -> None:
      if raise_on_error:
          raise ValueError(msg)
      else:
          warnings.warn(msg)
  
imports: import copy
  import warnings
  from typing import Any, List, Optional
  import torch
  from torch import Tensor
  from typing_extensions import Self
  from torch_geometric.data import Data, HeteroData
  from torch_geometric.typing import EdgeType, NodeType, OptTensor
  from torch_geometric.utils import select
  from torch_geometric.utils._subgraph import hyper_subgraph
label_desc: Use image node_id 1 for calling a global function with example usage: warn_or_raise(msg, raise_on_error) without return types