def track_prop_dict_length(track_prop_dict):
    """Returns the number of tracks in a track properties dictionary.
    Raises an exception if the value lists in the input dictionary are
    not all of the same length. Returns zero if the track properties
    dict is empty."""

    # A fancy way of checking if all value lists are the same length
    val_list_lengths = set(map(len, track_prop_dict.values()))
    if len(val_list_lengths) > 1:
        raise ValueError("Invalid track prop dictionary: "
                "value lists are of different sizes")
    if len(val_list_lengths) == 0:
        return 0

    return next(iter(val_list_lengths))