def _calc_bin_size(n_bins, t_start, t_stop):
    """
    Calculates the stop point from given parameters.

    Calculates the size of bins `bin_size` from the three parameters
    `n_bins`, `t_start` and `t_stop`.

    Parameters
    ----------
    n_bins : int
        Number of bins
    t_start : pq.Quantity
        Start time
    t_stop : pq.Quantity
        Stop time

    Returns
    -------
    bin_size : pq.Quantity
        Size of bins calculated from given parameters.

    Raises
    ------
    ValueError
        When `t_stop` is smaller than `t_start`.
    """

    if n_bins is not None and t_start is not None and t_stop is not None:
        if t_stop < t_start:
            raise ValueError("t_stop (%s) is smaller than t_start (%s)"
                             % (t_stop, t_start))
        return (t_stop - t_start) / n_bins