def apply_local_threshold(latency_ms, server_descriptions):
    """All servers with round trip times within latency_ms of the fastest one.

    No ServerDescription's round_trip_time can be None.

    The `server_descriptions` passed to this function should have
    non-readable servers (e.g. RSGhost, RSArbiter, Unknown) filtered
    out (e.g. by readable_server_selector or secondary_server_selector)
    first.
    """
    if not server_descriptions:
        # Avoid ValueError from min() with empty sequence.
        return []

    # round_trip_time is in seconds.
    if any(s for s in server_descriptions if s.round_trip_time is None):
        raise ValueError("Not all servers' round trip times are known")

    fastest = min(s.round_trip_time for s in server_descriptions)
    return [
        s for s in server_descriptions
        if (s.round_trip_time - fastest) <= latency_ms / 1000.]