<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 on_raw_quit(self, message):
 """ QUIT command. """

        nick, metadata = self._parse_user(message.source)

        self._sync_user(nick, metadata)
        if message.params:
            reason = message.params[0]
        else:
            reason = None

        await self.on_quit(nick, reason)
        # Remove user from database.
        if not self.is_same_nick(self.nickname, nick):
            self._destroy_user(nick)
        # Else, we quit.
        elif self.connected:
            await self.disconnect(expected=True)