def scale_size(size, sizer):
    """Scales a size tuple based on a sizer tuple.

    A sizer is just a size tuple that specifies only width or height.
    """
    if not any(sizer):
        return size
    size_new = list(sizer)
    i = size_new.index(None)
    j = i * -1 + 1
    size_new[i] = size_new[j] * size[i] // size[j]
    return tuple(size_new)
