def check_extension(filename, extensions=("jpg", "jpeg", "png", "gif",)):
    """ Checks if the filename contains any of the specified extensions """

    bits = filename.split(".")
    bits.reverse()

    ext = bits[0].lower()

    return ext in extensions