def get_delay_share(trains, threshold):
    """Returns share of trains with delay greater or equal `threshold`.

    Args:
        trains (iterable[Connection]): Iterable holding trains.
        threshold (number): Threshold greater or equal a delay must be
          to be considered.
    """
    delayed = 0
    with_data = 0
    for train in trains:
        if train.delay and train.delay >= threshold:
            delayed += 1
        with_data += 1
    return delayed / with_data
