@thiago.eec Note that Calibre comes with BeautifulSoup 3.0.5. (The current version is 4.4.)
For BeautifulSoup 3.0.5 you'll have to slightly change your code:
Code:
from calibre.ebooks.BeautifulSoup import BeautifulSoup
snippet = '"<section xmlns="http://www.w3.org/1999/xhtml" xmlns:epub="http://www.idpf.org/2007/ops" epub:type="epigraph">"'
soup = BeautifulSoup(snippet)
if soup.section.has_key('epub:type'):
epub_type = soup.section['epub:type']