<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def collapse(self, indices, values):
 """Partly collapse the interval product to single values. Note that no changes are made in-place. Parameters indices : int or sequence of ints The indices of the dimensions along which to collapse. values : `array-like` or float The values to which to collapse. Must have the same length as ``indices``. Values must lie within the interval boundaries. Returns ------- collapsed : `IntervalProd` The collapsed set. Examples -------- IntervalProd([-1., 0., 2.], [-0.5, 0. , 3. ]) IntervalProd([-1. , 0. , 2.5], [-0.5, 0. , 2.5]) """

        indices = np.atleast_1d(indices).astype('int64', casting='safe')
        values = np.atleast_1d(values)
        if len(indices) != len(values):
            raise ValueError('lengths of indices {} and values {} do not '
                             'match ({} != {})'
                             ''.format(indices, values,
                                       len(indices), len(values)))

        for axis, index in enumerate(indices):
            if not 0 <= index <= self.ndim:
                raise IndexError('in axis {}: index {} out of range 0 --> {}'
                                 ''.format(axis, index, self.ndim - 1))

        if np.any(values < self.min_pt[indices]):
            raise ValueError('values {} not above the lower interval '
                             'boundaries {}'
                             ''.format(values, self.min_pt[indices]))

        if np.any(values > self.max_pt[indices]):
            raise ValueError('values {} not below the upper interval '
                             'boundaries {}'
                             ''.format(values, self.max_pt[indices]))

        b_new = self.min_pt.copy()
        b_new[indices] = values
        e_new = self.max_pt.copy()
        e_new[indices] = values

        return IntervalProd(b_new, e_new)