def get_selector_root(sel):
    """ Return lxml Element for a Selector """
    if not hasattr(sel, 'root'):
        # scrapy.Selector, scrapy < 1.1
        return sel._root
    # parsel.Selector or scrapy.Selector, scrapy >= 1.1
    return sel.root