<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def getImageByTag(tag):
    '''Check if an image with a given tag exists. No side-effects. Idempotent.
    Handles ImageNotFound and APIError exceptions, but only reraises APIError.
    '''
    require_str("tag", tag)

    image = None
    try:
        image = client.images.get(tag)
        print("Found image", tag, "...")
    except ImageNotFound:
        print("Image", tag, "does not exist ...")
    except APIError as exc:
        eprint("Unhandled error while getting image", tag)
        raise exc

    return image