Python port of Threefold