changes the username to given username, throws exception if username used

def change_name(self, username):
        """ changes the username to given username, throws exception if username used """
        self.release_name()

        try:
            self.server.register_name(username)
        except UsernameInUseException:
            logging.log(', '.join(self.server.registered_names))
            self.server.register_name(self.name)
            raise
            
        self.name = username