def _times_to_steps(ts, num_trotter_slices):
    """
    Based on the requested times `ts`, calculate Trotter step numbers at which
    (subsystems of) evolved states need to be saved.

    .. doctest::

        >>> _times_to_steps([10, 25, 30], 100)
        ([33, 83, 100], 0.3)
        >>> _times_to_steps([8, 26, 19], 80)
        ([25, 80, 58], 0.325)

    Args:
        ts (list[float]):
            The times for which the evolution should be computed and the
            state of the full system or a subsystem returned (i.e. it's reduced
            density matrix (for now only works with method='mpo'. If the
            method is not mpo, omit subsystems)). The algorithm will
            calculate the evolution using the given number of Trotter steps
            for the largest number in ts. On the way there it will store the
            evolved states for smaller times.
            NB: Beware of memory overload since len(t)
            mpnum.MPArrays will be stored
        num_trotter_slices (int): Number of Trotter slices to be used for the
            largest t in ts.

    Returns:
        tuple[list[int], float]: step numbers, tau = maximal t /
        num_trotter_slices
    """
    tau = max(ts) / num_trotter_slices
    step_numbers = [int(round(t / tau)) for t in ts]
    return step_numbers, tau