def make_zoom_window(bounding_box, region_size, padding=2, invert=False):
    """
    Computes a zoom window around a target bounding box.

    Parameters
    ----------
    bounding_box : dict of ints
        This dict represents the target bounding box and should have the form::

            {
                'x_min': int,
                'x_max': int,
                'y_min': int,
                'y_max': int
            }

        where the ints describe the maximal and minimal indices of pixels along
        the x- and y-axes included within the bounding box, respectively.
    region_size : int
        The side length of the square region within which the target bounding
        box lies, in pixels.
    padding : int
        The number of pixels to include within the zoom window around the
        bounding box. If the zoom window is at the edge of the region, it may be
        impossible to pad by the specified number of pixels, in which case the
        zoom window will be shifted away from the edge of the region.
    invert : bool
        If True, the zoom window will be reflected across the diagonal.

    Returns
    -------
    dict of int
        This dict represents the computed zoom window and has the following
        structure::

            {
                'x_start': int,
                'y_start': int,
                'size': int
            }

        where x_start and y_start refer to the indices of the lowest-indexed
        pixel to be included in the zoom window along each axis, and size
        indicates the side length of the square zoom window in pixels.
    """
    zoom_window_size = max(bounding_box['x_max'] - bounding_box['x_min'], 
        bounding_box['y_max'] - bounding_box['y_min']) + 1 + 2 * padding
    zoom_window = {'x_start': bounding_box['x_min'] - padding, 'y_start': 
        bounding_box['y_min'] - padding, 'size': zoom_window_size}
    if invert:
        zoom_window = {'x_start': bounding_box['y_min'] - padding,
            'y_start': bounding_box['x_min'] - padding, 'size':
            zoom_window_size}
    if zoom_window['x_start'] + zoom_window['size'] - 1 >= region_size:
        zoom_window['x_start'] -= zoom_window['x_start'] + zoom_window['size'
            ] - region_size
    if zoom_window['y_start'] + zoom_window['size'] - 1 >= region_size:
        zoom_window['y_start'] -= zoom_window['y_start'] + zoom_window['size'
            ] - region_size
    if zoom_window['x_start'] < 0:
        zoom_window['x_start'] -= zoom_window['x_start']
    if zoom_window['y_start'] < 0:
        zoom_window['y_start'] -= zoom_window['y_start']
    return zoom_window
