<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_set(self, flag, new):
 """ Return the boolean value of 'flag'. If 'new' is set, the flag is updated, and the value before update is returned. """

        old = self._is_set(flag)
        if new is True:
            self._set(flag)
        elif new is False:
            self._clear(flag)
        return old