how to check if an object is created with `with` statement?,x.do_something()