code: def sanitize_path_comp(path_comp):
      result = []
      for char in path_comp:
          if char not in string.ascii_letters + string.digits + "-_.":
              result.append("_")
          else:
              result.append(char)
      return "".join(result)
  
imports: import os
  from os import path
  import string
  import errno
  from glob import glob
  import nibabel
  import imghdr
  from .base import TraitedSpec, DynamicTraitedSpec, InputMultiPath, File, Directory, traits, BaseInterface, isdefined, Undefined
label_desc: Use image node_id 1 for calling a global function with example usage: sanitize_path_comp(path_comp) and returns: str