<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 part(self, channel, message=None):
 """ Leave channel, optionally with message. """

        if not self.in_channel(channel):
            raise NotInChannel(channel)

        # Message seems to be an extension to the spec.
        if message:
            await self.rawmsg('PART', channel, message)
        else:
            await self.rawmsg('PART', channel)