def irc_NICK(self, prefix, params):
        """
        Nick message -- Set your nickname.

        Parameters: <nickname>

        [REQUIRED]
        """
        nickname = params[0]
        try:
            if isinstance(nickname, bytes):
                nickname = nickname.decode(self.encoding)
        except UnicodeDecodeError:
            self.privmsg(
                NICKSERV,
                repr(nickname),
                'Your nickname cannot be decoded. Please use ASCII or UTF-8.')
            self.transport.loseConnection()
            return

        self.nickname = nickname
        self.name = nickname

        for code, text in self._motdMessages:
            self.sendMessage(code, text % self.factory._serverInfo)

        if self.password is None:
            self.privmsg(
                NICKSERV,
                nickname,
                'Password?')
        else:
            password = self.password
            self.password = None
            self.logInAs(nickname, password)

        Nick message -- Set your nickname.

        Parameters: <nickname>

        [REQUIRED]
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/words/service.py