get the context of a search by keyword 'My keywords' in beautifulsoup `soup`,k = soup.find(text=re.compile('My keywords')).parent.text