def _xpath_to_dict(self, element, property_map, namespace_map):
result = {}<EOL>log.info(etree.tostring(element, pretty_print=True))<EOL>for key in property_map:<EOL><INDENT>item = property_map[key]<EOL>log.info(u'<STR_LIT>'.format(key=key, xpath=item[u'<STR_LIT>']))<EOL>nodes = element.xpath(item[u'<STR_LIT>'], namespaces=namespace_map)<EOL>if nodes:<EOL><INDENT>result_for_node = []<EOL>for node in nodes:<EOL><INDENT>cast_as = item.get(u'<STR_LIT>', None)<EOL>if cast_as == u'<STR_LIT>':<EOL><INDENT>result_for_node.append(self._parse_date(node.text))<EOL><DEDENT>elif cast_as == u'<STR_LIT>':<EOL><INDENT>result_for_node.append(self._parse_date_only_naive(node.text))<EOL><DEDENT>elif cast_as == u'<STR_LIT:int>':<EOL><INDENT>result_for_node.append(int(node.text))<EOL><DEDENT>elif cast_as == u'<STR_LIT:bool>':<EOL><INDENT>if node.text.lower() == u'<STR_LIT:true>':<EOL><INDENT>result_for_node.append(True)<EOL><DEDENT>else:<EOL><INDENT>result_for_node.append(False)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>result_for_node.append(node.text)<EOL><DEDENT><DEDENT>if not result_for_node:<EOL><INDENT>result[key] = None<EOL><DEDENT>elif len(result_for_node) == <NUM_LIT:1>:<EOL><INDENT>result[key] = result_for_node[<NUM_LIT:0>]<EOL><DEDENT>else:<EOL><INDENT>result[key] = result_for_node<EOL><DEDENT><DEDENT><DEDENT>return result<EOL>
property_map = {
  u'name'         : { u'xpath' : u't:Mailbox/t:Name'},
  u'email'        : { u'xpath' : u't:Mailbox/t:EmailAddress'},
  u'response'     : { u'xpath' : u't:ResponseType'},
  u'last_response': { u'xpath' : u't:LastResponseTime', u'cast': u'datetime'},
}

This runs the given xpath on the node and returns a dictionary