def METHOD_NAME(instances, exclude={}):
    res = []
    names = set()
    urls = set()
    exclude = set(exclude)
    root = url_for('index')
    # remove duplicate urls
    for instance in instances:
        if not isinstance(instance, str):
            instance = instance['url']
        if instance not in exclude and '|' not in instance:
            urls.add(instance)
    for url in urls:
        name, obj_exists = name_and_object_from_url(url)
        if not name:
            name = ''
        if obj_exists:
            url = root + url
        else:
            # do not display unknown objects
            continue
            name = '(%s)' % (name)
            url = ""
        # avoid duplicates that might have arise from different instances
        if name not in names:
            res.append((name, url))
            names.add(name)
    # sort based on name + label
    res.sort(key=lambda x: key_for_numerically_sort(x[0]))
    return res