from BeautifulSoup import BeautifulSoup
doc = Soup('<ul><li>1</li><li class="second">2</li><li>3</li></div>')
doc.select("li.second")
from lxml.etree import fromstring
from lxml.cssselect import CSSSelector
doc = fromstring('<ul><li>1</li><li class="second">2</li><li>3</li></div>')
selector = CSSSelector('li.second')
selector(doc)