def retrieve_properties_ex(vim, prop_coll, spec_set, max_count=500):
    """Retrieve properties.

    Retrieve properties using PropertyCollector.RetrievePropertiesEx
    and PropertyCollector.ContinueRetrievePropertiesEx
    args:
    :param vim: Vim object
    :param prop_coll: PropertyCollector MOR
    :param max_count: Max num of objects returned in a single call.
    """
    objcont = []
    client_factory = vim.client.factory
    opts = client_factory.create('ns0:RetrieveOptions')
    opts.maxObjects = max_count
    res = vim.RetrievePropertiesEx(prop_coll, specSet=spec_set, options=opts)
    while True:
        if res and res.objects:
            objcont.extend(res.objects)
        if hasattr(res, 'token') and res.token:
            res = vim.ContinueRetrievePropertiesEx(prop_coll, token=res.token)
        else:
            break
    return objcont
