def region (im, ylo, yhi, xlo, xhi):
    """
    Return a rectangular region of an image.

    Arguments:
     im  image from which the region is to be taken
    ylo  lower y-value (row) of the region
    yhi  higher y-value (row) of the region
    xlo  lower x-value (column) of the region
    xhi  higher x-value (column) of the region
    """
    return im[ylo:yhi,xlo:xhi,:]