def rect(img, corners, color='r', linewidth=3):
    """
        Draw rectangle on image 

        Add limits according to image dimensions
        Parameters 
        ----------
        corners : list
            ymin,ymax,xmin,xmax
        linewidth : int 
            number of pixels the lines od the rectangle cover. Should 
            be odd.
        Returns 
        -------
    """
    colrgb = [255, 0, 0]
    olap = (linewidth - 1) / 2
    img[corners[1] - olap:corners[1] + olap + 1, corners[2]:corners[3]
        ] = colrgb
    img[corners[0] - olap:corners[0] + olap + 1, corners[2]:corners[3]
        ] = colrgb
    img[corners[0]:corners[1], corners[2] - olap:corners[2] + olap + 1
        ] = colrgb
    img[corners[0]:corners[1], corners[3] - olap:corners[3] + olap + 1
        ] = colrgb
    return img
