def get_link_attribute(self, link_text, attribute, hard_fail=True):
soup = self.get_beautiful_soup()<EOL>html_links = soup.find_all('<STR_LIT:a>')<EOL>for html_link in html_links:<EOL><INDENT>if html_link.text.strip() == link_text.strip():<EOL><INDENT>if html_link.has_attr(attribute):<EOL><INDENT>attribute_value = html_link.get(attribute)<EOL>return attribute_value<EOL><DEDENT>if hard_fail:<EOL><INDENT>raise Exception(<EOL>'<STR_LIT>'<EOL>% (attribute, link_text))<EOL><DEDENT>else:<EOL><INDENT>return None<EOL><DEDENT><DEDENT><DEDENT>if hard_fail:<EOL><INDENT>raise Exception("<STR_LIT>" % link_text)<EOL><DEDENT>else:<EOL><INDENT>return None<EOL><DEDENT>
Finds a link by link text and then returns the attribute's value.
            If the link text or attribute cannot be found, an exception will
            get raised if hard_fail is True (otherwise None is returned).