Python reference implementation of pffy idioms