code: def xpath(node, query, namespaces={}):
      
      if namespaces and 'None' not in namespaces:
          return node.xpath(query, namespaces=namespaces)
      return node.xpath(query)
docs: A safe xpath that only uses namespaces if available.