def replace_constant(img, remove_coord, constant):
    """
    Replaces region in image defined by remove_coord with constant value

    Parameters
    -------------------------------------
    img: ndarray
        Contains image data
    remove_region: tuple
        Coordinates of box containing the remove_region. Order is: (
            top left x-coordinate,
            top left y-coordinate,
            bottom right x-coordinate,
            bottom right y-coordinate
        )
    constant: int
        Value to replace all colors in remove_region
    Returns
    -------------------------------------
    ndarray
        transformed image
    """
    remove_x1, remove_y1, remove_x2, remove_y2 = remove_coord
    imgcopy = img.copy()
    imgcopy[remove_y1:remove_y2, remove_x1:remove_x2] = constant
    return imgcopy