def get_cutout(image, cutout_size):
    """Takes an image, and cuts it down to `cutout_size x cutout_size`
    It only affects the final two dimensions of the array, so
    you can easily deal with multiple images / multiple channels
    simply by setting up the array with shape (n_channels, height, width)
    
    Inputs
    ------
    image : np.ndarray (ndim >= 2)
    cutout_size : int
        the [maximum] number of pixels you want in each dimension
        of the final image.



    Notes
    -----
    If `cutout_size` is large than an image dimension, it'll silently
    keep *the entire* range of that dimension. This won't have any 
    side-effects on the other dimension of non-square images.
"""
    image_shape = image.shape[-2:]

    
    center_index = (image_shape[0]//2, image_shape[1]//2)

    # Check that these are actually x and y ordered
    min_x = center_index[0] - (cutout_size//2)
    max_x = center_index[0] + (cutout_size//2)
    min_y = center_index[1] - (cutout_size//2)
    max_y = center_index[1] + (cutout_size//2)
    
    if cutout_size % 2 == 1:
        # handle odd number of pixels
        max_x += 1
        max_y += 1

    cutout = image[..., min_x:max_x, min_y:max_y]
    
    return cutout