def _generate_data_for_format(fmt):
<EOL>data = {}<EOL>free_size_start = False<EOL>for literal_text, field_name, format_spec, conversion in formatter.parse(fmt):<EOL><INDENT>if literal_text:<EOL><INDENT>free_size_start = False<EOL><DEDENT>if not field_name:<EOL><INDENT>free_size_start = False<EOL>continue<EOL><DEDENT>if not format_spec or format_spec == "<STR_LIT:s>" or format_spec == "<STR_LIT:d>":<EOL><INDENT>if free_size_start:<EOL><INDENT>return None<EOL><DEDENT>else:<EOL><INDENT>free_size_start = True<EOL><DEDENT><DEDENT>if format_spec and '<STR_LIT:%>' in format_spec:<EOL><INDENT>t = dt.datetime.now()<EOL>t = parse(<EOL>"<STR_LIT>" + format_spec + "<STR_LIT:}>", compose("<STR_LIT>" + format_spec + "<STR_LIT:}>", {'<STR_LIT:t>': t}))['<STR_LIT:t>']<EOL>data[field_name] = t<EOL><DEDENT>elif format_spec and '<STR_LIT:d>' in format_spec:<EOL><INDENT>if not format_spec.isalpha():<EOL><INDENT>n = _get_number_from_fmt(format_spec)<EOL><DEDENT>else:<EOL><INDENT>return None<EOL><DEDENT>data[field_name] = random.randint(<NUM_LIT:0>, <NUM_LIT>) % (<NUM_LIT:10> ** n)<EOL><DEDENT>else:<EOL><INDENT>if format_spec is None:<EOL><INDENT>n = <NUM_LIT:4><EOL><DEDENT>elif format_spec.isalnum():<EOL><INDENT>n = _get_number_from_fmt(format_spec)<EOL><DEDENT>else:<EOL><INDENT>n = <NUM_LIT:4><EOL><DEDENT>randstri = '<STR_LIT>'<EOL>for x in range(n):<EOL><INDENT>randstri += random.choice(string.ascii_letters)<EOL><DEDENT>data[field_name] = randstri<EOL><DEDENT><DEDENT>return data<EOL>
Generate a fake data dictionary to fill in the provided format string.