from pathlib import Path


def _check_output_path(output_path, file_ext):
    """
    Creates the output path if it doesnt exist.

    :type output_path: Path | str
    :param output_path: the output path to create

    :type file_ext: str
    :param file_ext: file extension of the output path

    :rtype: Path
    :return: the output path with the file extension
    """
    output_path = Path(output_path)
    if not output_path.parent.exists():
        output_path.parent.mkdir(parents=True)

    if output_path.suffix != file_ext:
        return output_path.with_suffix(file_ext)
    else:
        return output_path