def _get_allocated_vnc_ports(session):
 vnc_ports = set()
 result = session._call_method(vim_util, 'get_objects', 'VirtualMachine', [VNC_CONFIG_KEY])
 while result:
  for obj in result.objects:
   if (not hasattr(obj, 'propSet')):
    continue
   dynamic_prop = obj.propSet[0]
   option_value = dynamic_prop.val
   vnc_port = option_value.value
   vnc_ports.add(int(vnc_port))
  result = session._call_method(vutil, 'continue_retrieval', result)
 return vnc_ports

def _get_allocated_vnc_ports ( session ) : vnc_ports = set ( ) result = session . _call_method ( vim_util , 'get_objects' , 'VirtualMachine' , [ VNC_CONFIG_KEY ] ) while result : for obj in result . objects : if ( not hasattr ( obj , 'propSet' ) ) : continue dynamic_prop = obj . propSet [ 0 ] option_value = dynamic_prop . val vnc_port = option_value . value vnc_ports . add ( int ( vnc_port ) ) result = session . _call_method ( vutil , 'continue_retrieval' , result ) return vnc_ports
return an integer set of all allocated vnc ports .