def match_link_to_brand(user_links):
    """
    Attempt to match a user's links to recognised brands (LinkBrand).
    This functionality also exists as a custom save() method on the model.
    -- Use this with functions that create and update in bulk.
    """
    for link in user_links:
        domain = urlsplit(link.url).netloc

        try:
            brand = LinkBrand.objects.get(domain=domain)
            link.icon = brand
            link.save()

        except __HOLE__:
            pass

    return user_links
dataset/ETHPy150Open nlhkabu/connect/connect/accounts/view_utils.py/match_link_to_brand