Python reimplementation of pubs