code: def serialize_array(array, domain=(0, 1), fmt="png", quality=70):
      """Given an arbitrary rank-3 NumPy array,
      returns the byte representation of the encoded image.
  
      Args:
        array: NumPy array of dtype uint8 and range 0 to 255
        domain: expected range of values in array, see `_normalize_array()`
        fmt: string describing desired file format, defaults to 'png'
        quality: specifies compression quality from 0 to 100 for lossy formats
  
      Returns:
        image data as BytesIO buffer
      """
      normalized = _normalize_array(array, domain=domain)
      return _serialize_normalized_array(
          normalized, fmt=fmt, quality=quality
      )
  
file_path: lucid/lucid/misc/io/serialize_array.py
imports: from __future__ import absolute_import, division, print_function
  import base64
  import logging
  import numpy
  import PIL.Image
  from io import BytesIO
label_desc: Use image node_id 3 for calling a global function with example usage: serialize_array(array, domain, fmt, quality) and returns: _serialize_normalized_array