human
I wrote the below code

    def callback(lexer, match, ctx=None):
        for (i, action) in enumerate(args):
            if (action is None):
                continue
            elif (type(action) is _TokenType):
                data = match.group((i + 1))
                if data:
                    (yield (match.start((i + 1)), action, data))
            else:
                data = match.group((i + 1))
                if (data is not None):
                    if ctx:
                        ctx.pos = match.start((i + 1))
                    for item in action(lexer, _PseudoMatch(match.start((i + 1)), data), ctx):
                        if item:
                            (yield item)
        if ctx:
            ctx.pos = match.end()
    return callback

What's a good function header?
assistant
#Here's a good function header.

def bygroups(*args):