<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_link_name (self, tag, attrs, attr):
 """Parse attrs for link name. Return name of link."""

        if tag == 'a' and attr == 'href':
            # Look for name only up to MAX_NAMELEN characters
            data = self.parser.peek(MAX_NAMELEN)
            data = data.decode(self.parser.encoding, "ignore")
            name = linkname.href_name(data)
            if not name:
                name = attrs.get_true('title', u'')
        elif tag == 'img':
            name = attrs.get_true('alt', u'')
            if not name:
                name = attrs.get_true('title', u'')
        else:
            name = u""
        return name