pet_check_code: optionally take schedule tree as input