class Foo (object):
def __enter__ (self):
print("Enter")
return 1
def __exit__ (self, exit, value, exc):
print("Exit")
with Foo() as foo:
print(foo)
Y2xhc3MgRm9vIChvYmplY3QpOgogICAgCiAgICBkZWYgX19lbnRlcl9fIChzZWxmKToKICAgICAgICBwcmludCgiRW50ZXIiKQogICAgICAgIHJldHVybiAxCiAgICAgICAgCiAgICBkZWYgX19leGl0X18gKHNlbGYsIGV4aXQsIHZhbHVlLCBleGMpOgogICAgICAgIHByaW50KCJFeGl0IikKICAgICAgICAKd2l0aCBGb28oKSBhcyBmb286CiAgICBwcmludChmb28pCg==