<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def hold_policy(document, policy, server=False):
 """ Context manager to temporary override the hold policy. """

    old_policy = document._hold
    document._hold = policy
    try:
        yield
    finally:
        if server and not old_policy:
            document.unhold()
        else:
            document._hold = old_policy