def _overlap (case, space):
    """
    This is a private method used only by the Maximal Rectangle algorithms that follow.

    Given a case and a space, it controls if the case partially overlap with the space.
    If this happens, the overlap is returned.

    :param case: The case
    :param space: The space
    :return: The overlap (if exists)

    """
    x, y, sizex, sizey = space
    right = min(case.x + case.sizex, x + sizex)
    left = max(case.x, x)
    top = min(case.y + case.sizey, y + sizey)
    bottom = max(case.y, y)
    if top > bottom and right > left:
        return (left, bottom, right - left, top - bottom)