def METHOD_NAME(args: argparse.Namespace) -> bool:
    result_xml_size = os.stat(args.result_xml).st_size
    if result_xml_size > MAX_RESULT_XML_SIZE_BYTES:
        logging.error(
            "Result XML file size is more than max allowed size (%d bytes): %d bytes. "
            "Refusing to parse this XML file and add the log path there.",
            MAX_RESULT_XML_SIZE_BYTES, result_xml_size)
        return False
    # Basic JUnit XML format description:
    #
    # <testsuites>        => the aggregated result of all junit testfiles
    #   <testsuite>       => the output from a single TestSuite
    #     <properties>    => the defined properties at test execution
    #       <property>    => name/value pair for a single property
    #       ...
    #     </properties>
    #     <error></error> => optional information, in place of a test case -
    #                        normally if the tests in the suite could not be found etc.
    #     <testcase>      => the results from executing a test method
    #       <system-out>  => data written to System.out during the test run
    #       <system-err>  => data written to System.err during the test run
    #       <skipped/>    => test was skipped
    #       <failure>     => test failed
    #       <error>       => test encountered an error
    #     </testcase>
    #     ...
    #   </testsuite>
    #   ...
    # </testsuites>
    #
    # (taken from http://help.catchsoftware.com/display/ET/JUnit+Format).
    xml_dom = minidom.parse(args.result_xml)
    # It might happen that test case passed and produced XML with passed results, but after that
    # fails due to additional instrumented checks (ThreadSanitizer, AddressSanitizer, etc)
    # with non-zero exit code. In this case we need to mark test case as failed by adding <error>
    # node to be recognized as failed by Jenkins. We also updating counter attributes if they
    # present and contain integer values.
    if args.mark_as_failed == 'true':
        for testcase_node in xml_dom.getElementsByTagName('testcase'):
            if (testcase_node.getElementsByTagName('error').length +
                    testcase_node.getElementsByTagName('failure').length == 0):
                error_node = xml_dom.createElement('error')
                testcase_node.appendChild(error_node)
                container_node = testcase_node.parentNode
                # Outermost elements have Document as a parent and Document has no parent.
                while container_node.parentNode:
                    errors_attr = container_node.getAttribute('errors')
                    if errors_attr:
                        try:
                            container_node.setAttribute('errors', str(int(errors_attr) + 1))
                        except ValueError:
                            # just skip
                            pass
                    container_node = container_node.parentNode
    extra_text = ""
    if args.extra_message:
        extra_text += "%s\n\n" % args.extra_message
    if args.log_url:
        extra_text += "Log: %s\n\n" % args.log_url
    if extra_text:
        # We are assuming that there may be some distinction between "failure" and "error" nodes.
        # E.g.  in some xUnit test frameworks "failures" are assertion failures and "errors" are
        # test program crashes happening even before we get to an assertion. We are treating these
        # two XML node types the same for the purpose of adding a log URL here.
        for tag_name in ('failure', 'error'):
            for failure_node in xml_dom.getElementsByTagName(tag_name):
                new_node = xml_dom.createTextNode(extra_text)
                if len(failure_node.childNodes) > 0:
                    failure_node.insertBefore(new_node, failure_node.firstChild)  # type: ignore
                else:
                    failure_node.appendChild(new_node)
    output_xml_bytes = xml_dom.toxml().encode('utf-8')
    with open(args.result_xml, 'wb') as output_file:
        output_file.write(output_xml_bytes)
    return True