def filter_by_length(genes, transcripts, min_length):
    """ Given a minimum transcript length, this function
          - Iterates over transcripts and keeps the ones with length >= min_length
          - Removes genes not represented in the transcript set
    """
    filtered_transcripts = {}
    filtered_genes = {}

    for transcript_id in transcripts:
        curr_transcript = transcripts[transcript_id]
        length = curr_transcript.get_length()

        if length >= min_length:
            filtered_transcripts[transcript_id] = curr_transcript
            gene_id = curr_transcript.gene_id
            if gene_id in genes:
                filtered_genes[gene_id] = genes[gene_id]

    return filtered_genes, filtered_transcripts