def adjust_crop(dst_w, dst_h, img_w, img_h):
    """
    given a x and y of dest, determine the ratio and return
    an (x,y,w,h) for a cropped image (note x or y could be neg).
    >>> adjust_crop(4,3,5,5)
    (0, -0.5, 4.0, 4.0)
    >>> adjust_crop(8,6,5,5)
    (0, -1.0, 8.0, 8.0)
    >>> adjust_crop(4,3,5,2)
    (-1.75, 0, 7.5, 3.0)
    >>> adjust_crop(8,6,5,2)
    (-3.5, 0, 15.0, 6.0)
    """
    dst_w = float(dst_w)
    dst_h = float(dst_h)
    img_w = float(img_w)
    img_h = float(img_h)

    dst_ratio = float(dst_w)/dst_h

    img_ratio = float(img_w)/img_h

    if dst_ratio > img_ratio:
        scale = dst_w/img_w
        x = 0
        w = dst_w
        h = img_h * scale
        y = dst_h/2 - h/2

    elif img_ratio <= dst_ratio:
        scale = dst_h/img_h
        y = 0
        w = img_w * scale
        h = img_h * scale
        x = dst_w/2 - w/2

    return x,y,w,h
dataset/ETHPy150Open mattharrison/rst2odp/odplib/imagescale.py/adjust_crop/swapped operands of `<=`