code: def diff(self, plot, serialize=True):
          
          diff = plot.state
          if serialize:
              return json.dumps(diff, cls=utils.PlotlyJSONEncoder)
          else:
              return diff
docs: Returns a json diff required to update an existing plot with
          the latest plot data.