code: def listen(self):
          db = self.config.get_database('control')
          kwargs = {}
          if 'shard_hint' in self.config['control']:
              kwargs['shard_hint'] = self.config['control']['shard_hint']
          pubsub = db.pubsub(**kwargs)
          channel = self.config['control'].get('channel', 'control')
          pubsub.subscribe(channel)
          for msg in pubsub.listen():
              if (msg['type'] in ('pmessage', 'message') and
                      msg['channel'] == channel):
                  command, _sep, args = msg['data'].partition(':')
                  if not command:
                      continue
                  if command[0] == '_':
                      LOG.error("Cannot call internal command %r" % command)
                      continue
                  if command in self._commands:
                      func = self._commands[command]
                  else:
                      func = utils.find_entrypoint('turnstile.command', command,
                                                   compat=False)
                      self._commands[command] = func
                  if not func:
                      LOG.error("No such command %r" % command)
                      continue
                  arglist = args.split(':') if args else []
                  try:
                      func(self, *arglist)
                  except Exception:
                      LOG.exception("Failed to execute command %r arguments %r" %
                                    (command, arglist))
                      continue