convert a css selector into an xpath expression. 
            xmlns is option single-item dict with namespace prefix and href

def selector_to_xpath(cls, selector, xmlns=None):
        """convert a css selector into an xpath expression. 
            xmlns is option single-item dict with namespace prefix and href
        """
        selector = selector.replace(' .', ' *.')
        if selector[0] == '.':
            selector = '*' + selector
            log.debug(selector)
        
        if '#' in selector:
            selector = selector.replace('#', '*#')
            log.debug(selector)

        if xmlns is not None:
            prefix = list(xmlns.keys())[0]
            href = xmlns[prefix]
            selector = ' '.join([
                (n.strip() != '>' and prefix + '|' + n.strip() or n.strip())
                for n in selector.split(' ')
                ])
            log.debug(selector)
        
        path = cssselect.GenericTranslator().css_to_xpath(selector)
        path = path.replace("descendant-or-self::", "")
        path = path.replace("/descendant::", "//")
        path = path.replace('/*/', '//')
        
        log.debug(' ==> %s' % path)
        
        return path