code: def _get_numpy_as_image(array):
      array = array.copy()  # prevent original array from modifying
  
      data_range_warnings = []
      array_min = array.min()
      array_max = array.max()
      if array_min < 0:
          data_range_warnings.append(
              f"the smallest value in the array is {array_min}"
          )
      if array_max > 1:
          data_range_warnings.append(
              f"the largest value in the array is {array_max}"
          )
      if data_range_warnings:
          data_range_warning_message = (
              " and ".join(data_range_warnings) + "."
          ).capitalize()
          logger.warning(
              "%s To be interpreted as colors correctly values in the array need to be in the [0, 1] range.",
              data_range_warning_message,
          )
      array *= 255
      shape = array.shape
      if len(shape) == 2:
          return _get_pil_image_data(
              pilimage_fromarray(array.astype(numpy_uint8))
          )
      if len(shape) == 3:
          if shape[2] == 1:
              array2d = numpy_array(
                  [[col[0] for col in row] for row in array]
              )
              return _get_pil_image_data(
                  pilimage_fromarray(array2d.astype(numpy_uint8))
              )
          if shape[2] in (3, 4):
              return _get_pil_image_data(
                  pilimage_fromarray(array.astype(numpy_uint8))
              )
      raise ValueError(
          "Incorrect size of numpy.ndarray. Should be 2-dimensional or"
          "3-dimensional with 3rd dimension of size 1, 3 or 4."
      )
  
imports: import base64
  import io
  import logging
  import pickle
  import warnings
  from io import BytesIO, StringIO
  from typing import Optional
  from packaging import version
  from pandas import DataFrame
  from neptune.exceptions import PlotlyIncompatibilityException
  from neptune.internal.utils.logger import logger
label_desc: Use image node_id 8 for calling a global function with example usage: _get_numpy_as_image(array) and returns: _get_pil_image_data, _get_pil_image_data, _get_pil_image_data