def findCompatibleVM(job,VMs,vml):
	rval = None	
	with vml:
		#logger.info( "   ...uuid is " + job['jobuuid'])
		#logger.info( "   ...app target is " + str(job['target']))
		for m in VMs.keys():
			#logger.info( "   seeing if " + VMs[m].name + " is compat...")
			#logger.info( "   ...version is " + str(int(VMs[m].version)) + " ...")
	#		#Don't process machines without the ms naming convention
	#		if not re.match('ms-vm\d{3}',VMs[m].name):
	#			continue


			#if the AndroidManifest doesn't havd a minsdk, maxsdk or targetsdk, then we don't know anything
			#about what version the app was created for, so we randomly pick something
			#if we pick "wrong" for our VM set, the job will just get delayed and we'll pick something else later

			targetsdk = int(job['target'])
			if targetsdk == 0:
				targetsdk = random.randint(MINSDKVER,MAXSDKVER)
				syslog.syslog("app %s didn't specify any sdk information selecting %s" % (job['sha256'],targetsdk))
				

	# states are Off=not powered on, Ready=powered on and ready for malware, Running=currently running (some other) malware, reserved=found, but not on yet
			if VMs[m].state in ["Off"] and int(VMs[m].version) == targetsdk:
				if not flagTerminate: #Dont assign more jobs if we are terminating
					logger.info( VMs[m].name + " (" + str(m) + ") is available")
					VMlocal = VMs[m];
					VMlocal.setState("Reserved")
					VMs[m] = VMlocal;
					
					rval = m
					break
					#job_assign(m) #vm is started at end of job assignment
					#Uncomment the next time to debug one job at a time
					#flagTerminate = True
			elif ["Running"] in VMs[m].state:
				v = 1
				#logger.info( VMs[m].name + " is running and not available for new malware")
				#if m.name in assignments:
				#	if assignments[m.name]['timeout'] <= time.time():
				#		#do anything you want to wrap up
				#		job_post_process(m)
				#		job_cleanup(m)
				#		vm_poweroff(m)
				#else: # if the machine is running but there is no job assigned to it then kill it
				#	pcap_terminate(m)
				#	vm_poweroff(m)
	#		else: #not sure this is relevant...may need to remove it
	#			vm_poweroff(m) #I need to get a list of states that I want to poweroff by default
	return rval
dataset/ETHPy150Open tvidas/a5/scripts/bin/control.py/findCompatibleVM/swapped operands of `in`