def bounds(window, transform):
    """Get the spatial bounds of a window.

    Parameters
    ----------
    window : a Window or window tuple
        The input window.
    transform: Affine
        an affine transform matrix.

    Returns
    -------
    x_min, y_min, x_max, y_max : float
        A tuple of spatial coordinate bounding values.
    """
    (row_min, row_max), (col_min, col_max) = window
    x_min, y_min = transform * (col_min, row_max)
    x_max, y_max = transform * (col_max, row_min)
    return x_min, y_min, x_max, y_max