def grep_gtf(args, gene_ids, mrna_ids):
    """
    Grep-like main function for *GTF* files.
    :param args:
    :return:

    :param gene_ids: set of gene IDs to retain/discard.
    :type gene_ids: set

    :param mrna_ids: set of mRNA IDs to retain/discard.
    :type mrna_ids: set

    """
    for record in args.gff:
        if not record:
            continue
        if args.genes is False:
            if record.transcript in mrna_ids:
                if not args.reverse:
                    print(record, file=args.out)
                elif args.reverse:
                    print(record, file=args.out)
        elif record.gene in gene_ids:
            if not args.reverse:
                print(record, file=args.out)
            elif args.reverse:
                print(record, file=args.out)
