code: def _serialize_viewport(viewport, manager):
      if viewport == "DATA_BOUNDS":
          payload = {"type": "DATA_BOUNDS"}
      else:
          try:
              payload = {
                  "type": "ZOOM_CENTER",
                  "center": viewport.center,
                  "zoom_level": viewport.zoom_level,
              }
          except AttributeError:
              raise ValueError("viewport")
      return payload
  
imports: import ipywidgets
  from traitlets import Unicode, default, List, Instance, observe, Dict, HasTraits, Enum, Union
  from .bounds import merge_longitude_bounds
  from .geotraitlets import Point, ZoomLevel, MapType, MouseHandling, Tilt
  from ._docutils import doc_subst
  from ._version import CLIENT_VERSION
label_desc: Use image node_id 2 for calling a global function with example usage: _serialize_viewport(viewport, manager) and returns: payload