def joined_iterator(gff_iterator, group_field=None):
    last_group_id = None
    matches = []

    if group_field is None:
        group_function = lambda x: x.attributes
    elif group_field == "gene_id":
        group_function = lambda x: x.gene_id
    elif group_field == "transcript_id":
        group_function = lambda x: x.transcript_id
    else:
        group_function = lambda x: x[group_field]

    for gff in gff_iterator:

        group_id = group_function(gff)

        if last_group_id != group_id:
            if last_group_id:
                yield matches
            matches = []
            last_group_id = group_id

        matches.append(gff)

    if last_group_id:
        yield matches
Ensure that when you encode the options, the retry_options are not
dataset/ETHPy150Open CGATOxford/cgat/CGAT/GTF.py/joined_iterator--crossover with--dataset/ETHPy150Open Workiva/furious/furious/tests/test_async.py/TestAsync.test_retry_value_without_to_task