def get_context(obj):
try:<EOL><INDENT>return obj._contexts[-<NUM_LIT:1>]<EOL><DEDENT>except (AttributeError, IndexError):<EOL><INDENT>pass<EOL><DEDENT>try:<EOL><INDENT>return obj._model._contexts[-<NUM_LIT:1>]<EOL><DEDENT>except (AttributeError, IndexError):<EOL><INDENT>pass<EOL><DEDENT>return None<EOL>
Search for a context manager