util: enhance `nullcontextmanager` to be able to return __enter__ result
This makes its functionality and signature equivalent to Python 3.7’s
contextlib.nullcontext().
To run the tests, do:cd tests/python run-tests.pySee https://mercurial-scm.org/wiki/WritingTests formore information on writing tests.