code: def change_extension(
      fname: Union[str, Path], new_ext: str
  ) -> Union[str, Path]:
      if isinstance(fname, str):
          return os.path.splitext(fname)[0] + new_ext
      elif isinstance(fname, Path):
          if new_ext[0] != ".":
              new_ext = "." + new_ext
          return fname.with_suffix(new_ext)
      else:
          raise RuntimeError(
              f"Received input argument `fname` for unsupported type {type(fname)}. Argument must be string or Path."
          )
  
file_path: pytorch-toolbelt/pytorch_toolbelt/utils/fs.py
imports: import glob
  import os
  from pathlib import Path
  from typing import Union, List, Iterable
  import cv2
  import numpy
label_desc: Use image node_id 10 for calling a global function with example usage: change_extension(fname, new_ext) and returns: unknown, fname