def _serve(war_file = None):
    """ Launch a SimpleHTTPServer listener to serve up our WAR file
    to the requesting host.  This is used primarily to serve a WAR
    to JBoss' jmx_deployer.

    If war_file is provided, this will make a copy of this file into
    our temp dir and remove it once its been completed.
    """

    try:
        if war_file:
            try:
                # rand payloads will already be moved, catch those errors
                copy(war_file, state.serve_dir)
            except: pass

        proc = Popen(["python", "-m", "SimpleHTTPServer", str(state.external_port)],
                        stdout=PIPE, stderr=PIPE, cwd=state.serve_dir)

        while proc.stderr.readline() not in 'GET':
            sleep(1.0)

        # this might be too short for huge files
        sleep(3.0)

    except Exception, e:
        utility.Msg(e, LOG.DEBUG)
    finally:
        kill(proc.pid, SIGINT)

    if war_file:
        war_name = parse_war_path(war_file, True)
        # remove our copied file
        remove("%s/%s" % (state.serve_dir, war_name))
dataset/ETHPy150Open hatRiot/clusterd/src/module/deploy_utils.py/_serve/swapped operands of `not in`