<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def rotation_matrix(self, angles):
 """Return the rotation matrix to the system state at ``angles``. Parameters angles : `array-like` or sequence Euler angles in radians describing the rotation of the detector. The length of the provided argument (along the first axis in case of an array) must be equal to the number of Euler angles in this geometry. Returns ------- rot : `numpy.ndarray` Rotation matrix (or matrices) mapping vectors at the initial state to the ones in the state defined by ``angles``. The rotation is extrinsic, i.e., defined in the "world" coordinate system. If ``angles`` is a single pair (or triplet) of Euler angles, an array of shape ``(3, 3)`` representing a single matrix is returned. Otherwise, the shape of the returned array is ``broadcast(*angles).shape + (3, 3)``. """

        squeeze_out = (np.broadcast(*angles).shape == ())
        angles_in = angles
        angles = tuple(np.array(angle, dtype=float, copy=False, ndmin=1)
                       for angle in angles)
        if (self.check_bounds and
                not is_inside_bounds(angles, self.motion_params)):
            raise ValueError('`angles` {} not in the valid range '
                             '{}'.format(angles_in, self.motion_params))

        matrix = euler_matrix(*angles)
        if squeeze_out:
            matrix = matrix.squeeze()

        return matrix