maybe_close

tfsnippet.utils.maybe_close(*args, **kwds)

Enter a context, and if obj has .close() method, close it when exiting the context.

Parameters:obj – The object maybe to close.
Yields:The specified obj.