ExitStack isn't available on recent six, so just try each contextlib.