Attempting dynamic generation with python