function.py split into generator and utility