import re
thehtml = """ 
    <p style="text-align: center;"><img src="http://example.com/smthg.png" alt="thealtttext" /></p>
    <p style="text-align: center;"><strong>My keywords : <a href="http://example.com/hello.html" target="_blank"> some text </a> </strong></p>
    <p style="text-align: center;"><strong>some other words : <a href="http://example.com/anotherlink.html" target="_blank"> some other words</a></strong></p>
    """
soup = bs4.BeautifulSoup(thehtml)
k = soup.find(text=re.compile('My keywords')).next_sibling['href']
print(k)
how to get the context of a search in BeautifulSoup?