<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_next_application_id(nodes):
 """ Calculates free application_id from given nodes :param nodes: :raises IOUError when exceeds number :return: integer first free id """

    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)")