Q:

How can I easily find out if a Python class accepts the with keyword? 

The only time I ever use the with keyword is when reading and writing files, mostly because that's the only case I actually know that I can use it.  I can imagine there are numerous instances where I preferably could have used with, but didn't know a class or method accepted it.  
So, how do I detect instances where the with keyword can be used? 

A:

Context managers all have __enter__() and __exit__() methods, so checking to see if those attributes exist and that they have __call__ attributes will work almost all the time. 
But yeah, read the code and/or documentation for the class first.