def index_of(alloc, host_id):
    """ Return the index of the given host id in the given alloc """
    for index, host in enumerate(alloc):
        if host == host_id:
            return index
    raise Exception('Host id not found in the allocation')
