code: def _image_to_bytes(image) -> bytes:
      if image is None:
          raise ValueError("image is None")
  
      elif is_numpy_array(image):
          return _get_numpy_as_image(image)
  
      elif is_pil_image(image):
          return _get_pil_image_data(image)
  
      elif is_matplotlib_figure(image):
          return _get_figure_image_data(image)
  
      elif _is_torch_tensor(image):
          return _get_numpy_as_image(image.detach().numpy())
  
      elif _is_tensorflow_tensor(image):
          return _get_numpy_as_image(image.numpy())
  
      elif is_seaborn_figure(image):
          return _get_figure_image_data(image.figure)
  
      raise TypeError("image is {}".format(type(image)))
  
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 4 for calling a global function with example usage: _image_to_bytes(image) and returns: _get_numpy_as_image, _get_pil_image_data, _get_figure_image_data, _get_numpy_as_image, _get_numpy_as_image, _get_figure_image_data