code: def diff(new, old):
      
  
      if old is not None:
          is_update = True
  
          removed = set(new.removed(old))
          updated = set(new.updated(old))
      else:
          is_update = False
  
          updated = new
          removed = set()
  
      return updated, removed, is_update
docs: Compute the difference in items of two revisioned collections. If only
      `new' is specified, it is assumed it is not an update. If both are set,
      the removed items are returned first. Otherwise, the updated and edited
      ones are returned.
  
      :param set new: Set of new objects
      :param set old: Set of old objects
      :return: A tuple consisting of `(added, removed, is_update)`.
      :rtype: tuple