Adding write functionality to papi.py