bs4.BeautifulSoup.findPrevious

BeautifulSoup.findPrevious(name=None, attrs={}, text=None, **kwargs)

Returns the first item that matches the given criteria and appears before this Tag in the document.