code: def diff(self, plot, binary=True):
          
          events = list(plot.document._held_events)
          if not events:
              return None
          msg = Protocol("1.0").create("PATCH-DOC", events, use_buffers=binary)
          plot.document._held_events = []
          return msg
docs: Returns a json diff required to update an existing plot with
          the latest plot data.