<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def save_image(img, fname):
 """Save an image. Parameters img : `PIL.Image` Image to save. fname : `str` File path. """

    _, ext = os.path.splitext(fname)
    ext = ext[1:] or 'png'
    with open(fname, 'wb') as fp:
        img.save(fp, ext)