from pathlib import Path


def verify_file(file, file_type, should_exist=True):
    """
        Verifies that the file is a Pathlib object and if not makes it one.
        Ensures that the file exists by default.
        This makes it possible to pass files into the various files as strings or as pathlib objects
    """
    if not isinstance(file, Path):
        file = Path(file)
    if should_exist and not file.is_file():
        raise Exception(
            "{file_type} file does not exist: {file} ".format(file_type=file_type, file=file)
        )

    return file