def validate_file(filename, extension):
    """
    Examine file that has been entered to ensure it is a valid filename for a
    particular file extension.

    :param filename:
        The filename to test.
    :param extension:
        The extension to test that appears AFTER THE LAST '.'
    :return:
        True if valid filename with extension. False if not valid filename
        with extension.
    """
    if extension == '':
        raise Exception(f' Invalid file extension. You entered {filename}')

    if filename.endswith(extension):
        # checks that a file exists and is not blank to the left of the file extension
        dot_position = filename.rfind('.')
        if len(filename[:dot_position]) > 0:
            return True
        else:
            raise Exception(f'Invalid Basename. You entered: {filename}')
    else:
        raise Exception(f'Invalid file extension. You entered: {filename}')