<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def replay_scope(self, sess):
 """Enters a replay scope that unsets it at the end."""

    current_replay = self.replay(sess)
    try:
      self.set_replay(sess, True)
      yield
    finally:
      self.set_replay(sess, current_replay)