def set_var(self, name, value, user=None):
        """
        Set a global or user variable
        :param name: The name of the variable to set
        :type  name: str

        :param value: The value of the variable to set
        :type  value: str

        :param user: If defining a user variable, the user identifier
        :type  user: str

        :raises UserNotDefinedError: The specified user does not exist
        """
        # Set a user variable
        if user is not None:
            if user not in self._users:
                raise UserNotDefinedError

            self._users[user].set_var(name, value)
            return

        # Set a global variable
        self._global_vars[name] = value