code: def _getFromFile(name):
      filename = name
      if filename[0] != ".":  # load from built-in directory
          dirname = path.dirname(__file__)
          filename = path.join(dirname, "colors/maps/" + filename)
      if not path.isfile(
          filename
      ):  # try suffixes if file is not found:
          if path.isfile(filename + ".csv"):
              filename += ".csv"
          elif path.isfile(filename + ".hex"):
              filename += ".hex"
      with open(filename, "r") as fh:
          idx = 0
          color_list = []
          if filename[-4:].lower() != ".hex":
              csv_mode = True
          else:
              csv_mode = False
          for line in fh:
              line = line.strip()
              if len(line) == 0:
                  continue  # empty line
              if line[0] == ";":
                  continue  # comment
              parts = line.split(
                  sep=";", maxsplit=1
              )  # split into color and names/comments
              if csv_mode:
                  comp = parts[0].split(",")
                  if len(comp) < 3:
                      continue  # not enough components given
                  color_tuple = tuple(
                      [int(255 * float(c) + 0.5) for c in comp]
                  )
              else:
                  hex_str = parts[0]
                  if hex_str[0] == "#":
                      hex_str = hex_str[1:]  # strip leading #
                  if len(hex_str) < 3:
                      continue  # not enough information
                  if len(hex_str) == 3:  # parse as abbreviated RGB
                      hex_str = (
                          2 * hex_str[0]
                          + 2 * hex_str[1]
                          + 2 * hex_str[2]
                      )
                  elif len(hex_str) == 4:  # parse as abbreviated RGBA
                      hex_str = (
                          2 * hex_str[0]
                          + 2 * hex_str[1]
                          + 2 * hex_str[2]
                          + 2 * hex_str[3]
                      )
                  if len(hex_str) < 6:
                      continue  # not enough information
                  try:
                      color_tuple = tuple(bytes.fromhex(hex_str))
                  except ValueError as e:
                      raise ValueError(
                          f"failed to convert hexadecimal value '{hex_str}'."
                      ) from e
              color_list.append(color_tuple)
              idx += 1
          # end of line reading loop
      # end of open
      cmap = ColorMap(
          name=name,
          pos=np.linspace(0.0, 1.0, len(color_list)),
          color=color_list,
      )  # , names=color_names)
      if cmap is not None:
          cmap.name = name
          _mapCache[name] = cmap
      return cmap
  
imports: from collections.abc import Callable, Sequence
  from os import listdir, path
  import numpy
  from .functions import clip_array, clip_scalar, colorDistance, eq, mkColor
  from .Qt import QtCore, QtGui
label_desc: Use image node_id 3 for calling a global function with example usage: _getFromFile(name) and returns: cmap