<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 ctcp(self, target, query, contents=None):
 """ Send a CTCP request to a target. """

        if self.is_channel(target) and not self.in_channel(target):
            raise client.NotInChannel(target)

        await self.message(target, construct_ctcp(query, contents))