code: def bytes_serializer(instance, widget):
      return {
          "data": bytearray(memoryview(instance.data).tobytes())
          if instance.data
          else None
      }
  
imports: import pytest
  from traitlets import Bool, Tuple, List, Instance, CFloat, CInt, Float, Int, TraitError, observe
  from .utils import setup, teardown
  import ipywidgets
  from ipywidgets import Widget
label_desc: Use image node_id 4 for calling a global function with example usage: bytes_serializer(instance, widget) and returns: dict