def parse_generator(configuration):
configuration = lowercase_keys(flatten_dictionaries(configuration))<EOL>gen_type = str(configuration.get(u'<STR_LIT:type>')).lower()<EOL>if gen_type not in GENERATOR_TYPES:<EOL><INDENT>raise ValueError(<EOL>'<STR_LIT>'.format(gen_type))<EOL><DEDENT>if gen_type == u'<STR_LIT>':<EOL><INDENT>return factory_env_variable(configuration[u'<STR_LIT>'])()<EOL><DEDENT>elif gen_type == u'<STR_LIT>':<EOL><INDENT>return factory_env_string(configuration[u'<STR_LIT:string>'])()<EOL><DEDENT>elif gen_type == u'<STR_LIT>':<EOL><INDENT>start = configuration.get('<STR_LIT:start>')<EOL>increment = configuration.get('<STR_LIT>')<EOL>if not start:<EOL><INDENT>start = <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>start = int(start)<EOL><DEDENT>if not increment:<EOL><INDENT>increment = <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>increment = int(increment)<EOL><DEDENT>return factory_generate_ids(start, increment)()<EOL><DEDENT>elif gen_type == u'<STR_LIT>':<EOL><INDENT>return generator_random_int32()<EOL><DEDENT>elif gen_type == u'<STR_LIT>':<EOL><INDENT>return parse_random_text_generator(configuration)<EOL><DEDENT>elif gen_type in GENERATOR_TYPES:<EOL><INDENT>return GENERATOR_PARSING[gen_type](configuration)<EOL><DEDENT>else:<EOL><INDENT>raise Exception("<STR_LIT>".format('<STR_LIT>'))<EOL><DEDENT>
Parses a configuration built from yaml and returns a generator
        Configuration should be a map