Assert that a filepath has the required file extension

    :param filepath: string filepath presumably containing a file extension
    :param ext_required: the expected file extension
        examples: ".pdf", ".html", ".tex"

def has_file_extension(filepath, ext_required):
    '''Assert that a filepath has the required file extension

    :param filepath: string filepath presumably containing a file extension
    :param ext_required: the expected file extension
        examples: ".pdf", ".html", ".tex"
    '''
    ext = os.path.splitext(filepath)[-1]
    if ext != ext_required:
        msg_tmpl = "The extension for {}, which is {}, does not equal {}"
        msg_format = msg_tmpl.format(filepath, ext, ext_required)
        raise ValueError(msg_format)
    return True