def median_zmw_subread(zmw_subreads):
    """Return subread_record with median seq_len.
    zmw_subreads is a list of ZMWTuple.
    """
    assert len(zmw_subreads) != 0

    sorted_subreads = sorted(zmw_subreads, key = lambda x: x.seq_len)

    # Not really a median since we round to the floor, and the definition of
    # median value would be the average of the two middle elements.
    # However, we need a concrete subread associated with the median value.
    median_id = len(sorted_subreads) // 2

    return sorted_subreads[median_id]