code: def get_next_application_id(nodes):
      
      used = set([n.application_id for n in nodes])
      pool = set(range(1, 512))
      try:
          return (pool - used).pop()
      except KeyError:
          raise IOUError("Cannot create a new IOU VM (limit of 512 VMs on one host reached)")
docs: Calculates free application_id from given nodes
  
      :param nodes:
      :raises IOUError when exceeds number
      :return: integer first free id