code: def update(self, uid: int, flag_set: Iterable[Flag],
                 op: FlagOp = FlagOp.REPLACE) -> FrozenSet[Flag]:
          
          orig_set = self._flags.get(uid, frozenset())
          new_flags = op.apply(orig_set, self & flag_set)
          if new_flags:
              self._flags[uid] = new_flags
          else:
              self._flags.pop(uid, None)
          return new_flags
docs: Update the flags for the session, returning the resulting flags.
  
          Args:
              uid: The message UID value.
              flag_set: The set of flags for the update operation.
              op: The type of update.