generator python class