def format_sequence(seq, start=None, end=None, group_size=<NUM_LIT:3>):
width = <NUM_LIT:100><EOL>loc_width = <NUM_LIT:9><EOL>sep = "<STR_LIT:U+0020>"<EOL>body_sep = "<STR_LIT>"<EOL>start = start or <NUM_LIT:0><EOL>end = end or len(seq)<EOL>bw = width - loc_width - len(body_sep)<EOL>assert group_size <= bw, "<STR_LIT>"<EOL>gpl = int((bw + len(sep)) / (group_size + len(sep)))    <EOL>gpl = int(gpl / <NUM_LIT:5>) * <NUM_LIT:5> if gpl > <NUM_LIT:20> else gpl<EOL>rpl = group_size * gpl<EOL>line_fmt = "<STR_LIT>".format(lw=loc_width, body_sep=body_sep)<EOL>ge_fmt = "<STR_LIT>".format(gs=group_size)<EOL>blocks = []<EOL>for ls in range(start, end, rpl):<EOL><INDENT>le = ls + rpl<EOL>groups = [<EOL>ge_fmt.format(ge=str(gs + group_size)[-group_size + <NUM_LIT:1>:])<EOL>for gs in range(ls, le, group_size)<EOL>]<EOL>blocks += [line_fmt.format(l="<STR_LIT>", body=sep.join(groups)) + "<STR_LIT:\n>"]<EOL>groups = [seq[gs:min(gs + group_size, end)] for gs in range(ls, le, group_size)]<EOL>blocks += [line_fmt.format(l=str(ls + <NUM_LIT:1>), body=sep.join(groups)) + "<STR_LIT:\n>"]<EOL>blocks += ["<STR_LIT:\n>"]<EOL><DEDENT>return blocks<EOL>
print seq from [start, end) in groups of size

            3   6   9  12  15
            |   |   |   |   |
     2001 AAA BBB CCC DDD EEE