def fill_contour(mask, contour):
    """
    Fill the inside of a contour, to go back to the original region.

    Parameters
    ----------
    mask : 2D :class:`~numpy:numpy.ndarray`
        full map on wich the contour is defined
    contour : dict
        The dict of 4 1D regions : top, bottom, left, right (returned by :func:`get_contour_boundaries`)

    Returns
    -------
    mask : the mask filled inside the contour
    """
    top_x = contour['top'][0]
    bottom_x = contour['top'][0]
    right_y = contour['right'][1]
    left_y = contour['left'][1]
    X_range = top_x if len(top_x) >= len(bottom_x) else bottom_x
    Y_range = right_y if len(right_y) >= len(left_y) else left_y
    for i,x in enumerate(X_range):
        for j, y in enumerate(Y_range):
            if x >= contour['left'][0][j] and x <= contour['right'][0][j]:
                if y >= contour['bottom'][1][i] and y <= contour['top'][1][i]:
                    mask[x,y] = 1
    return mask