Python Return Function From Use Effect Definition