Port to pure Python (3.2)