def _gen(d, limit=<NUM_LIT:20>, count=False, grouprefs=None):
if grouprefs is None:<EOL><INDENT>grouprefs = {}<EOL><DEDENT>ret = ['<STR_LIT>']<EOL>strings = <NUM_LIT:0><EOL>literal = False<EOL>for i in d:<EOL><INDENT>if i[<NUM_LIT:0>] == sre_parse.IN:<EOL><INDENT>subs = _in(i[<NUM_LIT:1>])<EOL>if count:<EOL><INDENT>strings = (strings or <NUM_LIT:1>) * len(subs)<EOL><DEDENT>ret = comb(ret, subs)<EOL><DEDENT>elif i[<NUM_LIT:0>] == sre_parse.LITERAL:<EOL><INDENT>literal = True<EOL>ret = mappend(ret, unichr(i[<NUM_LIT:1>]))<EOL><DEDENT>elif i[<NUM_LIT:0>] == sre_parse.CATEGORY:<EOL><INDENT>subs = CATEGORIES.get(i[<NUM_LIT:1>], ['<STR_LIT>'])<EOL>if count:<EOL><INDENT>strings = (strings or <NUM_LIT:1>) * len(subs)<EOL><DEDENT>ret = comb(ret, subs)<EOL><DEDENT>elif i[<NUM_LIT:0>] == sre_parse.ANY:<EOL><INDENT>subs = CATEGORIES['<STR_LIT>']<EOL>if count:<EOL><INDENT>strings = (strings or <NUM_LIT:1>) * len(subs)<EOL><DEDENT>ret = comb(ret, subs)<EOL><DEDENT>elif i[<NUM_LIT:0>] == sre_parse.MAX_REPEAT or i[<NUM_LIT:0>] == sre_parse.MIN_REPEAT:<EOL><INDENT>items = list(i[<NUM_LIT:1>][<NUM_LIT:2>])<EOL>if i[<NUM_LIT:1>][<NUM_LIT:1>] + <NUM_LIT:1> - i[<NUM_LIT:1>][<NUM_LIT:0>] >= limit:<EOL><INDENT>r1 = i[<NUM_LIT:1>][<NUM_LIT:0>]<EOL>r2 = i[<NUM_LIT:1>][<NUM_LIT:0>] + limit<EOL><DEDENT>else:<EOL><INDENT>r1 = i[<NUM_LIT:1>][<NUM_LIT:0>]<EOL>r2 = i[<NUM_LIT:1>][<NUM_LIT:1>] + <NUM_LIT:1><EOL><DEDENT>ran = range(r1, r2)<EOL>if count:<EOL><INDENT>branch_count = <NUM_LIT:0><EOL>for p in ran:<EOL><INDENT>branch_count += pow(_gen(items, limit, True, grouprefs), p)<EOL><DEDENT>strings = (strings or <NUM_LIT:1>) * branch_count<EOL><DEDENT>ret = prods(ret, ran, items, limit, grouprefs)<EOL><DEDENT>elif i[<NUM_LIT:0>] == sre_parse.BRANCH:<EOL><INDENT>if count:<EOL><INDENT>for x in i[<NUM_LIT:1>][<NUM_LIT:1>]:<EOL><INDENT>strings += _gen(x, limit, True, grouprefs) or <NUM_LIT:1><EOL><DEDENT><DEDENT>ret = concit(ret, i[<NUM_LIT:1>][<NUM_LIT:1>], limit, grouprefs)<EOL><DEDENT>elif i[<NUM_LIT:0>] == sre_parse.SUBPATTERN or i[<NUM_LIT:0>] == sre_parse.ASSERT:<EOL><INDENT>subexpr = i[<NUM_LIT:1>][<NUM_LIT:1>]<EOL>if IS_PY36_OR_GREATER and i[<NUM_LIT:0>] == sre_parse.SUBPATTERN:<EOL><INDENT>subexpr = i[<NUM_LIT:1>][<NUM_LIT:3>]<EOL><DEDENT>if count:<EOL><INDENT>strings = (<EOL>strings or <NUM_LIT:1>) * (sum(ggen([<NUM_LIT:0>], _gen, subexpr, limit=limit, count=True, grouprefs=grouprefs)) or <NUM_LIT:1>)<EOL><DEDENT>ret = ggen(ret, _gen, subexpr, limit=limit, count=False, grouprefs=grouprefs, groupref=i[<NUM_LIT:1>][<NUM_LIT:0>])<EOL><DEDENT>elif i[<NUM_LIT:0>] == sre_parse.AT:<EOL><INDENT>continue<EOL><DEDENT>elif i[<NUM_LIT:0>] == sre_parse.NOT_LITERAL:<EOL><INDENT>subs = list(CATEGORIES['<STR_LIT>'])<EOL>if unichr(i[<NUM_LIT:1>]) in subs:<EOL><INDENT>subs.remove(unichr(i[<NUM_LIT:1>]))<EOL><DEDENT>if count:<EOL><INDENT>strings = (strings or <NUM_LIT:1>) * len(subs)<EOL><DEDENT>ret = comb(ret, subs)<EOL><DEDENT>elif i[<NUM_LIT:0>] == sre_parse.GROUPREF:<EOL><INDENT>ret = dappend(ret, grouprefs, i[<NUM_LIT:1>])<EOL><DEDENT>elif i[<NUM_LIT:0>] == sre_parse.ASSERT_NOT:<EOL><INDENT>pass<EOL><DEDENT>else:<EOL><INDENT>print('<STR_LIT>' + repr(i))<EOL><DEDENT><DEDENT>if count:<EOL><INDENT>if strings == <NUM_LIT:0> and literal:<EOL><INDENT>inc = True<EOL>for i in d:<EOL><INDENT>if i[<NUM_LIT:0>] not in (sre_parse.AT, sre_parse.LITERAL):<EOL><INDENT>inc = False<EOL><DEDENT><DEDENT>if inc:<EOL><INDENT>strings = <NUM_LIT:1><EOL><DEDENT><DEDENT>return strings<EOL><DEDENT>return ret<EOL>
docstring for _gen