def METHOD_NAME( mRNAs, f ):
    fh = open(f, 'wt')
    fh.write("##gff-version 3\n")
    mRNA_ids = dict()
    genes_to_print = list()
    for mRNA in mRNAs:
        mRNA_ids[mRNA.id] = 1
        if mRNA.parent not in genes_to_print:
            genes_to_print.append(mRNA.parent)
    for gene in sorted(genes_to_print):
        mRNAs_to_keep = []
        original_mRNAs = []
        for mRNA in gene.mRNAs():
            original_mRNAs.append(mRNA)
            if mRNA.id in mRNA_ids:
                mRNAs_to_keep.append(mRNA)
        gene.children['mRNA'] = mRNAs_to_keep
        gene.print_as(fh=fh, source='SOURCE', format='gff3')
        gene.children['mRNA'] = original_mRNAs