code: def _get_figure_as_image(figure):
      with io.BytesIO() as image_buffer:
          figure.savefig(
              image_buffer, format="png", bbox_inches="tight"
          )
          return image_buffer.getvalue()
  
file_path: neptune-client/src/neptune/legacy/internal/utils/image.py
imports: import io
  import os
  import numpy
  import six
  from PIL import Image
  from neptune.legacy.exceptions import FileNotFound, InvalidChannelValue
label_desc: Use image node_id 2 for calling a global function with example usage: _get_figure_as_image(figure) and returns: image_buffer