'Returns a rectangular region from the core image object im.
This is equivalent to calling im.crop((x0, y0, x1, y1)), but
includes additional sanity checks.
:param im: a core image object
:param box: The crop rectangle, as a (left, upper, right, lower)-tuple.
:returns: A core image object.'

def _crop(self, im, box):

    (x0, y0, x1, y1) = map(int, map(round, box))
    if (x1 < x0):
        x1 = x0
    if (y1 < y0):
        y1 = y0
    _decompression_bomb_check((x1, y1))
    return im.crop((x0, y0, x1, y1))
