code: def as_rgb_tuple(x: Union[np.ndarray, tuple, list, str]) -> tuple:
      "Convert np RGB values -> tuple for PIL compatibility"
      if isinstance(x, (np.ndarray, tuple, list)):
          if not len(x) == 3:
              raise ValueError(
                  f"Expected 3 (RGB) numbers, got {len(x)}"
              )
          if isinstance(x, np.ndarray):
              return tuple(x.astype(np.int))
          elif isinstance(x, tuple):
              return x
          elif isinstance(x, list):
              return tuple(x)
      elif isinstance(x, str):
          return PIL.ImageColor.getrgb(x)
      else:
          raise ValueError(
              f"Expected {{np.ndarray|list|tuple}}, got {type(x)}"
          )
  
file_path: icevision/icevision/visualize/utils.py
imports: from icevision.imports import *
  from icevision.utils import *
  from matplotlib import patches
  from PIL import Image, ImageFont, ImageDraw
  import PIL
label_desc: Use image node_id 4 for calling a global function with example usage: as_rgb_tuple(x) and returns: tuple, PIL, x, tuple