import re


def imageFile(str):
    """
    function from
    https://www.geeksforgeeks.org/how-to-validate-image-file-extension-using-regular-expression/

    Used to check the urls of cover images, to see if they are images.
    """
    # Regex to check valid image file extension.
    regex = "([^\\s]+(\\.(?i)(jpe?g|png|gif|bmp))$)"
    p = re.compile(regex)

    if(re.search(p, str)):
        return True
    else:
        return False