code: def cmode(self, channel, modes=''):
          
          with self.lock:
              self.is_in_channel(channel)
  
              if not modes:
                      self.send('MODE %s' % channel)
                      modes = ''
                      mode_set_time = None
                      while self.readable():
                          msg = self._recv(rm_colon=True, \
                          expected_replies=('324', '329'))
                          if msg[0] == '324':
                              modes = msg[2].split()[1].replace('+', '', 1)
                          elif msg[0] == '329':
                              mode_set_time = self._m_time.localtime( \
                                                          int(msg[2].split()[1]))
                      return modes, mode_set_time
              else:
                  self.send('MODE %s %s' % (channel, modes))
  
                  if self.readable():
                      msg = self._recv(expected_replies=('MODE',), \
                                           ignore_unexpected_replies=True)
                      if msg[0]:
                          mode = msg[2]
                          self.parse_cmode_string(mode, msg[1])
                          if not self.hide_called_events:
                              self.stepback()
docs: Sets or gets the channel mode.
          Required arguments:
          * channel - Channel to set/get modes of.
          Optional arguments:
          * modes='' - Modes to set.
              If not specified return the modes of the channel.