code: def create_thumbnail(
      ex: np.ndarray,
      *,
      use_colormap: bool,
      default_dimensions: bool = True,
  ) -> PilImage:
      """Creates the image from the np.array input."""
      PIL_Image = (
          lazy_imports_lib.lazy_imports.PIL_Image
      )  # pylint: disable=invalid-name
  
      if (
          use_colormap
      ):  # Apply the colormap first as it modify the shape/dtype
          ex = apply_colormap(ex)
  
      _, _, c = ex.shape
      postprocess = _postprocess_noop
      if c == 1:
          ex = ex.squeeze(axis=-1)
          mode = "L"
      elif ex.dtype == np.uint16:
          mode = "I;16"
          postprocess = _postprocess_convert_rgb
      else:
          mode = None
      img = PIL_Image.fromarray(ex, mode=mode)
      img = postprocess(img)
      if default_dimensions:
          img.thumbnail(
              (THUMBNAIL_SIZE, THUMBNAIL_SIZE)
          )  # Resize the image in-place
      return img
  
imports: from __future__ import annotations
  import csv
  import subprocess
  from typing import Any, List, Optional
  import numpy
  from tensorflow_datasets.core import lazy_imports_lib
  from tensorflow_datasets.core.utils import py_utils
  from tensorflow_datasets.core.utils import resource_utils
  from tensorflow_datasets.core.utils import tf_utils
  from tensorflow_datasets.core.utils.lazy_imports_utils import tensorflow
label_desc: Use image node_id 10 for calling a global function with example usage: create_thumbnail(ex) and returns: img