def METHOD_NAME(infile: str, outfile: str, version: str, novalidation: bool, graph: bool):
    """
    CLI-tool for validating SPDX documents and converting between RDF, TAG-VALUE, JSON, YAML and XML formats.
    Formats are determined by the file endings.
    To use, run: 'pyspdxtools --infile <input file name> --outfile <output file name>'
    """
    try:
        document: Document = parse_file(infile)
        if not novalidation:
            if not version:
                version = document.creation_info.spdx_version
            if version not in ["SPDX-2.2", "SPDX-2.3"]:
                logging.error(f"This tool only supports SPDX versions SPDX-2.2 and SPDX-2.3, but got: {version}")
                sys.exit(1)
            validation_messages: List[ValidationMessage] = validate_full_spdx_document(document, version)
            if validation_messages:
                log_string = "\n".join(
                    ["The document is invalid. The following issues have been found:"]
                    + [message.validation_message for message in validation_messages]
                )
                logging.error(log_string)
                sys.exit(1)
            else:
                logging.info("The document is valid.")
        if outfile == "-":
            tagvalue_writer.write_document(document, sys.stdout)
        elif graph:
            try:
                export_graph_from_document(document, outfile)
            except ImportError:
                logging.error(
                    "To be able to draw a relationship graph of the parsed document "
                    "you need to install 'networkx' and 'pygraphviz'. Run 'pip install \".[graph_generation]\"'."
                )
                sys.exit(1)
        elif outfile:
            write_file(document, outfile, validate=False)
    except NotImplementedError as err:
        logging.error(
            err.args[0]
            + "\nPlease note that this project is currently undergoing a major refactoring and therefore missing "
            "a few features which will be added in time (refer to https://github.com/spdx/tools-python/issues "
            "for insights into the current status).\n"
            "In the meantime, please use the current PyPI release version."
        )
        sys.exit(1)
    except SPDXParsingError as err:
        log_string = "\n".join(
            ["There have been issues while parsing the provided document:"]
            + [message for message in err.get_messages()]
        )
        logging.error(log_string)
        sys.exit(1)