'Yield (element, attribute, link, pos), where attribute may be None
(indicating the link is in the text).  ``pos`` is the position
where the link occurs; often 0, but sometimes something else in
the case of links in stylesheets or style tags.
Note: <base href> is *not* taken into account in any way.  The
link you get is exactly the link in the document.
Note: multiple links inside of a single text string or
attribute value are returned in reversed order.  This makes it
possible to replace or delete them from the text string value
based on their reported text positions.  Otherwise, a
modification at one text position can change the positions of
links reported later on.'

def iterlinks(self):

    link_attrs = defs.link_attrs
    for el in self.iter(etree.Element):
        attribs = el.attrib
        tag = _nons(el.tag)
        if (tag != 'object'):
            for attrib in link_attrs:
                if (attrib in attribs):
                    (yield (el, attrib, attribs[attrib], 0))
        elif (tag == 'object'):
            codebase = None
            if ('codebase' in attribs):
                codebase = el.get('codebase')
                (yield (el, 'codebase', codebase, 0))
            for attrib in ('classid', 'data'):
                if (attrib in attribs):
                    value = el.get(attrib)
                    if (codebase is not None):
                        value = urljoin(codebase, value)
                    (yield (el, attrib, value, 0))
            if ('archive' in attribs):
                for match in _archive_re.finditer(el.get('archive')):
                    value = match.group(0)
                    if (codebase is not None):
                        value = urljoin(codebase, value)
                    (yield (el, 'archive', value, match.start()))
        if (tag == 'param'):
            valuetype = (el.get('valuetype') or '')
            if (valuetype.lower() == 'ref'):
                (yield (el, 'value', el.get('value'), 0))
        if ((tag == 'style') and el.text):
            urls = ([_unquote_match(match.group(1), match.start(1)) for match in _css_url_re.finditer(el.text)] + [(match.group(1), match.start(1)) for match in _css_import_re.finditer(el.text)])
            if urls:
                urls = [(start, url) for (url, start) in urls]
                urls.sort()
                urls.reverse()
                for (start, url) in urls:
                    (yield (el, None, url, start))
        if ('style' in attribs):
            urls = list(_css_url_re.finditer(attribs['style']))
            if urls:
                for match in urls[::(-1)]:
                    (url, start) = _unquote_match(match.group(1), match.start(1))
                    (yield (el, 'style', url, start))
