def start_consul_instance(acl_master_token=None):
ports = dict(zip(<EOL>['<STR_LIT:http>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>'],<EOL>get_free_ports(<NUM_LIT:4>) + [-<NUM_LIT:1>]))<EOL>config = {'<STR_LIT>': ports, '<STR_LIT>': {'<STR_LIT>': <NUM_LIT:1>},<EOL>'<STR_LIT>': True}<EOL>if acl_master_token:<EOL><INDENT>config['<STR_LIT>'] = '<STR_LIT>'<EOL>config['<STR_LIT>'] = acl_master_token<EOL><DEDENT>tmpdir = py.path.local(tempfile.mkdtemp())<EOL>tmpdir.join('<STR_LIT>').write(json.dumps(config))<EOL>tmpdir.chdir()<EOL>(system, node, release, version, machine, processor) = platform.uname()<EOL>if system == '<STR_LIT>':<EOL><INDENT>postfix = '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>postfix = '<STR_LIT>'<EOL><DEDENT>bin = os.path.join(os.path.dirname(__file__), '<STR_LIT>'+postfix)<EOL>command = '<STR_LIT>''<STR_LIT>''<STR_LIT>'<EOL>command = command.format(bin=bin).strip()<EOL>command = shlex.split(command)<EOL>with open('<STR_LIT>', '<STR_LIT:w>') as devnull:<EOL><INDENT>p = subprocess.Popen(<EOL>command, stdout=devnull, stderr=devnull)<EOL><DEDENT>base_uri = '<STR_LIT>' % ports['<STR_LIT:http>']<EOL>while True:<EOL><INDENT>time.sleep(<NUM_LIT:0.1>)<EOL>try:<EOL><INDENT>response = requests.get(base_uri + '<STR_LIT>')<EOL><DEDENT>except requests.ConnectionError:<EOL><INDENT>continue<EOL><DEDENT>print(response.text)<EOL>if response.text.strip() != '<STR_LIT>':<EOL><INDENT>break<EOL><DEDENT><DEDENT>requests.put(base_uri + '<STR_LIT>', data='<STR_LIT>')<EOL>while True:<EOL><INDENT>response = requests.get(base_uri + '<STR_LIT>')<EOL>if response.text.strip() != '<STR_LIT>':<EOL><INDENT>break<EOL><DEDENT>time.sleep(<NUM_LIT:0.1>)<EOL><DEDENT>requests.put(base_uri + '<STR_LIT>')<EOL>time.sleep(<NUM_LIT:2>)<EOL>return p, ports['<STR_LIT:http>']<EOL>
starts a consul instance. if acl_master_token is None, acl will be disabled
for this server, otherwise it will be enabled and the master token will be
set to the supplied token

returns: a tuple of the instances process object and the http port the
         instance is listening on