I don't really understand what you said, but your `generate_visualization_frame` is what's called a factory function (http://en.wikipedia.org/wiki/Factory_method_pattern).