def convert_hierarchy(first_gffs, second_gffs, options):

    hierarchy = {}

    for gff in first_gffs:

        if not(options.parent == "Parent"):
            if options.parent in gff.asDict():
                gff['Parent'] = gff[options.parent].split(",")
            else:
                gff['Parent'] = []

        hierarchy[gff['ID']] = {
            "type": gff.feature,
            "Parent": gff.asDict().get("Parent", []),
            "gene_id": gff.attributes.get(
                options.gene_field_or_pattern, gff['ID']),
            "transcript_id": gff.attributes.get(
                options.transcript_field_or_pattern, gff['ID'])}

    for gff in second_gffs:

        if options.discard and (
                (options.missing_gene and options.parent not in gff) or (
                gff.feature in (options.gene_type, options.transcript_type))):

            continue

        gene_ids, transcript_ids, poss_transcript_ids = search_hierarchy(
            gff['ID'], hierarchy, options)

        assert len(gene_ids) > 0 and len(transcript_ids) > 0

        if options.missing_gene:

            transcript_ids = [poss if found is None else found
                              for found, poss in
                              zip(transcript_ids, poss_transcript_ids)]

            transcript_ids = [gid if found is None else found
                              for found, gid in
                              zip(transcript_ids, gene_ids)]

        elif None in transcript_ids:
            raise ValueError("failed to find transcript id for %s" % gff['ID'])

        for gene_id, transcript_id in zip(gene_ids, transcript_ids):

            gff.gene_id = gene_id
            gff.transcript_id = transcript_id

            gtf_entry = GTF.Entry()
            gtf_entry.copy(gff)
            if "Parent" in gtf_entry:
                gtf_entry['Parent'] = ",".join(gtf_entry['Parent'])

            options.stdout.write(str(gtf_entry) + "\n")
L{SSHProcotolChecker.registerChecker} should add the given checker to
dataset/ETHPy150Open CGATOxford/cgat/scripts/gff32gtf.py/convert_hierarchy--crossover with--dataset/ETHPy150Open kuri65536/python-for-android/python-modules/twisted/twisted/conch/test/test_checkers.py/SSHProtocolCheckerTestCase.test_registerChecker