def pic_search(pic, artist):
    "\n    Function to retrieve the images of artworks collected in the Art institute of Chicago\n\n    Parameters:\n    -------------\n    pic: the title of the artwork\n    artist: the full name of the artist\n\n    Returns:\n    -------------\n    Status code: str\n        if the API request went through\n    Image: jpg\n        The image of the searched atwork\n    Error Message:\n        Error messsage if the search is invalid\n\n    Example:\n    -------------\n    >>>pic_search('Water Lillies', 'Claude Monet')\n\n    "
    params_search_pic = {'q': pic}
    rp = requests.get('https://api.artic.edu/api/v1/artworks/search?fields=id,title,artist_display,image_id', params=params_search_pic)
    linkhead = 'https://www.artic.edu/iiif/2/'
    linktail = '/full/843,/0/default.jpg'
    try:
        status = rp.status_code
    except HTTPError as http_err:
        print(f'HTTP error occurred: {http_err}')
    except Exception as err:
        print(f'Other error occurred: {err}')
    else:
        print('no error (successfully made request)')
        rp1 = json.dumps(rp.json(), indent=2)
        picsearch = json.loads(rp1)
        npic = pd.DataFrame(picsearch['data'])
        pic_info = npic[['id', 'title', 'artist_display', 'image_id']]
        df_len = len(pic_info)
        for i in range(df_len):
            if ((pic_info.iloc[i]['title'] == pic) and (artist in pic_info.iloc[i]['artist_display'])):
                get_image_id = pic_info.iloc[i]['image_id']
                image_link = ((linkhead + get_image_id) + linktail)
                response = requests.get(image_link)
                img = Image.open(BytesIO(response.content))
                return img
        print('Invalid Search! Please find related information below :)')
        return pic_info
Function to retrieve the images of artworks collected in the Art institute of Chicago

Parameters:
-------------
pic: the title of the artwork
artist: the full name of the artist

Returns:
-------------
Status code: str
    if the API request went through
Image: jpg
    The image of the searched atwork
Error Message:
    Error messsage if the search is invalid

Example:
-------------
>>>pic_search('Water Lillies', 'Claude Monet')
def pic_search(pic, artist):
    "\n    Function to retrieve the images of artworks collected in the Art institute of Chicago\n\n    Parameters:\n    -------------\n    pic: the title of the artwork\n    artist: the full name of the artist\n\n    Returns:\n    -------------\n    Status code: str\n        if the API request went through\n    Image: jpg\n        The image of the searched atwork\n    Error Message:\n        Error messsage if the search is invalid\n\n    Example:\n    -------------\n    >>>pic_search('Water Lillies', 'Claude Monet')\n\n    "
    params_search_pic = {'q': pic}
    rp = requests.get('https://api.artic.edu/api/v1/artworks/search?fields=id,title,artist_display,image_id', params=params_search_pic)
    linkhead = 'https://www.artic.edu/iiif/2/'
    linktail = '/full/843,/0/default.jpg'
    try:
        status = rp.status_code
    except HTTPError as http_err:
        print(f'HTTP error occurred: {http_err}')
    except Exception as err:
        print(f'Other error occurred: {err}')
    else:
        print('no error (successfully made request)')
        rp1 = json.dumps(rp.json(), indent=2)
        picsearch = json.loads(rp1)
        npic = pd.DataFrame(picsearch['data'])
        pic_info = npic[['id', 'title', 'artist_display', 'image_id']]
        df_len = len(pic_info)
        for i in range(df_len):
            if ((pic_info.iloc[i]['title'] == pic) and (artist in pic_info.iloc[i]['artist_display'])):
                get_image_id = pic_info.iloc[i]['image_id']
                image_link = ((linkhead + get_image_id) + linktail)
                response = requests.get(image_link)
                img = Image.open(BytesIO(response.content))
                return img
        print('Invalid Search! Please find related information below :)')
        return pic_info