Human: how to get the context of a search in BeautifulSoup? Assistant: 
Here is some code to get the context of a search by keyword 'My keywords' in beautifulsoup `soup`

k = soup.find(text=re.compile('My keywords')).parent.text

#Warning: this code generation is experimental. Please inspect the code for any bugs before executing.