Small which replacement that can be used as a Python module