Sometimes I need a dummy context manager that does nothing. It can then be used as a stand-in for a more useful, but optional, context manager. For example:
ctx_
Simple solution for Python 2.7, not yet mentioned in the answers:
from contextlib import nested with nested(): ...