import requests
import imghdr


def is_image(url) -> bool:
    """
    Determine if it is an image of png or jpeg.
    Parameters
    ----------
    url : str
        Target url.
    Returns
    -------
    True or False: Return True if this url content is an image of png or jpeg else returns False.
    """
    img = requests.get(url).content
    img_type = imghdr.what(None, h=img)

    if img_type in ['png', 'jpeg']:
        return True
    else:
        return False