def irc_WHOIS(self, prefix, params):
        """
        Whois query

        Parameters: [ <target> ] <mask> *( "," <mask> )
        """
        def cbUser(user):
            self.whois(
                self.name,
                user.name, user.name, self.realm.name,
                user.name, self.realm.name, 'Hi mom!', False,
                int(time() - user.lastMessage), user.signOn,
                ['#' + group.name for group in user.itergroups()])

        def ebUser(err):
            err.trap(ewords.NoSuchUser)
            self.sendMessage(
                irc.ERR_NOSUCHNICK,
                params[0],
                ":No such nick/channel")

        try:
            user = params[0]
            if isinstance(user, bytes):
                user = user.decode(self.encoding)
        except UnicodeDecodeError:
            self.sendMessage(
                irc.ERR_NOSUCHNICK,
                params[0],
                ":No such nick/channel")
            return

        self.realm.lookupUser(user).addCallbacks(cbUser, ebUser)

        Whois query

        Parameters: [ <target> ] <mask> *( "," <mask> )
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/words/service.py