def METHOD_NAME(self, item, response):
    """Parse or generate links."""
    documents = []
    if type(item) == Selector:
        relative_urls = item.xpath(".//a/@href").extract()
        for relative_url in relative_urls:
            documents.append(self._build_link_dict(response.urljoin(relative_url)))
    else:
        elems = item.split(",")
        for elem in elems:
            regex = re.compile(r'<a href="(?P<url>.*?)"')
            m = regex.search(elem)
            try:
                relative_url = m.group("url")
                documents.append(
                    self._build_link_dict(response.urljoin(relative_url))
                )
            except AttributeError:
                continue  # Not a problem, some of these do not contain links.
    return documents