[IMP] better use of standard Python API