Sets/gets the channel topic.
        Required arguments:
        * channel - Channel to set/get the topic for.
        Optional arguments:
        * topic - Topic to set.
            If not specified the current channel topic will be returned.

def topic(self, channel, topic=None):
        """
        Sets/gets the channel topic.
        Required arguments:
        * channel - Channel to set/get the topic for.
        Optional arguments:
        * topic - Topic to set.
            If not specified the current channel topic will be returned.
        """
        with self.lock:
            self.is_in_channel(channel)

            if topic:
                self.send('TOPIC %s :%s' % (channel, topic))
                if self.readable():
                    msg = self._recv(expected_replies=('TOPIC',))
                    if msg[0] == 'TOPIC' and self.hide_called_events:
                        channel = msg[1]
                        self.channels[channel]['TOPIC'] = \
                        msg[2].replace(':', '', 1)
                        if not self.hide_called_events:
                            self.stepback()
            else:
                topic = ''
                set_by = ''
                time_set = ''
                self.send('TOPIC %s' % channel)
                while self.readable():
                    msg = self._recv(expected_replies=('332', '333', '331'))
                    if msg[0] == '332':
                        topic = msg[2].split(':', 1)[1]
                    elif msg[0] == '333':
                        set_by, time_set = msg[2].split()[1:]
                        if self.UTC == False:
                            time_set = self._m_time.localtime(int(time_set))
                        else:
                            time_set = self._m_time.gmtime(int(time_set))
                        set_by = self._from_(set_by)
                    elif msg[0] == '331':
                        topic = ''

                return topic, set_by, time_set