def absolute_links_patch(doc, web_url):
    """Patching the invalid IPV6 URL. lxml was throwing an error due to which absolute links were
    not added.

    @:param: web_url: domain of the website from the page url.
    @:param: document in the form of lxml element.
    @:return: doc instance
    """
    to_drop = []
    for item in doc.xpath('.//a'):
        if item.get('href'):
            if item.get('href').__contains__('[') or item.get('href'
                ).__contains__(']'):
                to_drop.append(item)
    for node in to_drop:
        node.drop_tree()
    doc.make_links_absolute(web_url)
    return doc
