fanfan's python lib