completed pipi.py