code: def recv_monitor_message(socket, flags=0):
      """Receive and decode the given raw message from the monitoring socket and return a dict.
  
      Requires libzmq ≥ 4.0
  
      The returned dict will have the following entries:
        event     : int, the event id as described in libzmq.zmq_socket_monitor
        value     : int, the event value associated with the event, see libzmq.zmq_socket_monitor
        endpoint  : string, the affected endpoint
  
      Parameters
      ----------
      socket : zmq PAIR socket
          The PAIR socket (created by other.get_monitor_socket()) on which to recv the message
      flags : bitfield (int)
          standard zmq recv flags
  
      Returns
      -------
      event : dict
          event description as dict with the keys `event`, `value`, and `endpoint`.
      """
      _check_version((4, 0), "libzmq event API")
      # will always return a list
      msg = socket.recv_multipart(flags)
      # 4.0-style event API
      return parse_monitor_message(msg)
  
imports: import struct
  import zmq
  from zmq.error import _check_version
label_desc: Use image node_id 2 for calling a global function with example usage: recv_monitor_message(socket, flags) and returns: parse_monitor_message