david's python pipe function