<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def calc_downsample(w, h, target=400):
 """Calculate downsampling value."""

    if w > h:
        return h / target
    elif h >= w:
        return w / target