Context manager generator for retry block pattern and decorator.

@cpennington I have added some more tests which verify that the isolation levels are changed correctly, even for nested isolation level changes. Are these sufficient?