<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 async def update_flags(self, selected: SelectedMailbox, sequence_set: SequenceSet, flag_set: FrozenSet[Flag], mode: FlagOp = FlagOp.REPLACE) \ -> Tuple[Iterable[Tuple[int, MessageInterface]], SelectedMailbox]: """Update the flags for the given set of messages. See Also: `RFC 3501 6.4.6. <https://tools.ietf.org/html/rfc3501#section-6.4.6>`_ Args: selected: The selected mailbox session. sequence_set: Sequence set of message sequences or UIDs. flag_set: Set of flags to update. mode: Update mode for the flag set. Raises: :class:`~pymap.exceptions.MailboxNotFound` :class:`~pymap.exceptions.MailboxReadOnly` """

        ...