code: def _get_labels(
      labels_or_path: Union[List[str], Path, str]
  ) -> List[str]:
      if isinstance(labels_or_path, (str, Path)):
          path = Path(labels_or_path)
          if path.suffix == ".json":
              return json.loads(path.read_text())
          elif path.suffix in {".yml", "yaml"}:
              return yaml.safe_load(path.read_bytes())
          else:
              raise ValueError(f"Unsupported file type: {path.suffix}")
      return labels_or_path
  
file_path: camphr/packages/camphr/camphr/ner_labels/utils.py
imports: import yaml
  from pathlib import Path
  from typing import IO, Dict, Iterable, List, Optional, Union
  import json
  from typing_extensions import Literal
label_desc: Use image node_id 2 for calling a global function with example usage: _get_labels(labels_or_path) and returns: labels_or_path, json, yaml