<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_context_manager(self, default):
 """A context manager for manipulating a default stack."""

        try:
            self.stack.append(default)
            yield default
        finally:
            if self.enforce_nesting:
                if self.stack[-1] is not default:
                    raise AssertionError(
                        "Nesting violated for default stack of %s objects"
                        % type(default))
                self.stack.pop()
            else:
                self.stack.remove(default)