make pipe.py a bit more Pythonic