docs: def parsemetadata(ebook):
  	"""Parses an etext meta-data definition to extract fields.
  	Args:
  		ebook (xml.etree.ElementTree.Element): An ebook meta-data definition.
  	"""
  	result = dict.fromkeys(META_FIELDS)
  	# get etext no
  	about = ebook.get('{%(rdf)s}about' % NS)
  	result['id'] = int(os.path.basename(about))
  	# author
  	creator = ebook.find('.//{%(dc)s}creator' % NS)
  	if creator is not None:
  		name = creator.find('.//{%(pg)s}name' % NS)
  		if name is not None:
  			result['author'] = safeunicode(name.text, encoding='utf-8')
  		birth = creator.find('.//{%(pg)s}birthdate' % NS)
  		if birth is not None:
  			result['authoryearofbirth'] = int(birth.text)
  		death = creator.find('.//{%(pg)s}deathdate' % NS)
  		if death is not None:
  			result['authoryearofdeath'] = int(death.text)
  	# title
  	title = ebook.find('.//{%(dc)s}title' % NS)
  	if title is not None:
  		result['title'] = fixsubtitles(
  				safeunicode(title.text, encoding='utf-8'))
  	# subject lists
  	result['subjects'], result['LCC'] = set(), set()
  	for subject in ebook.findall('.//{%(dc)s}subject' % NS):
  		res = subject.find('.//{%(dcam)s}memberOf' % NS)
  		if res is None:
  			continue
  		res = res.get('{%(rdf)s}resource' % NS)
  		value = subject.find('.//{%(rdf)s}value' % NS).text
  		if res == ('%(dc)sLCSH' % NS):
  			result['subjects'].add(value)
  		elif res == ('%(dc)sLCC' % NS):
  			result['LCC'].add(value)
  	# formats
  	result['formats'] = {file.find('{%(dc)s}format//{%(rdf)s}value' % NS).text:
  			file.get('{%(rdf)s}about' % NS)
  			for file in ebook.findall('.//{%(pg)s}file' % NS)}
  	# type
  	booktype = ebook.find('.//{%(dc)s}type//{%(rdf)s}value' % NS)
  	if booktype is not None:
  		result['type'] = booktype.text
  	# languages
  	lang = ebook.findall('.//{%(dc)s}language//{%(rdf)s}value' % NS)
  	result['language'] = [a.text for a in lang] or None
  	# download count
  	downloads = ebook.find('.//{%(pg)s}downloads' % NS)
  	if downloads is not None:
  		result['downloads'] = int(downloads.text)
  	return result