fix python helper function