def __exit__(self, exc_type, exc_value, traceback):
if exc_type is None:<EOL><INDENT>self.commit()<EOL><DEDENT>elif isinstance(exc_value, OffsetOutOfRangeError):<EOL><INDENT>self.handle_out_of_range()<EOL>return True<EOL><DEDENT>else:<EOL><INDENT>self.rollback()<EOL><DEDENT>
End a context.

 -  If there was no exception, commit up to the current high-water mark.
 -  If there was an offset of range error, attempt to find the correct
    initial offset.
 -  If there was any other error, roll back to the initial offsets.