How could this ever occur, since we only add to the context in this class's `__enter__` method? Also, if for some reason you are worried about this happening, why not just check that `isinstance(network, Network)`? I like to avoid try-catch blocks, incase e.g. there's an `AttributeError` in `network.generate_key()`.