def METHOD_NAME(self, href):
    if href:
        try:
            url = urlparse(href)
        except ValueError:
            return ' rel="nofollow"'
        else:
            if url.netloc and url.netloc not in NOFOLLOW_WHITELIST:
                return ' rel="nofollow"'
    return ''