PCI rewritten to Python3