<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def stack_pop(self, key):
 """Remove a value in a task context stack """

        task = Task.current_task()
        try:
            context = task._context_stack
        except AttributeError:
            raise KeyError('pop from empty stack') from None
        value = context[key]
        stack_value = value.pop()
        if not value:
            context.pop(key)
        return stack_value