def METHOD_NAME(size, longest_side):
    """Return integer tuple of width and height given size and longest_side length."""
    width, height = size
    if width > height:
        width = longest_side
        height = (height / width) * longest_side
    elif height > width:
        height = longest_side
        width = (width / height) * longest_side
    else:
        height = longest_side
        width = longest_side
    return flat(width, height)