'Parse an @page selector.
:param tokens:
An iterable of token, typically from the  ``head`` attribute of
an unparsed :class:`AtRule`.
:returns:
A page selector. For CSS 2.1, this is ``\'first\'``, ``\'left\'``,
``\'right\'`` or ``None``.
:raises:
:class:`~.parsing.ParseError` on invalid selectors'

def parse_page_selector(self, tokens):

    if (not tokens):
        return (None, (0, 0))
    if ((len(tokens) == 2) and (tokens[0].type == u':') and (tokens[1].type == u'IDENT')):
        pseudo_class = tokens[1].value
        specificity = {u'first': (1, 0), u'left': (0, 1), u'right': (0, 1)}.get(pseudo_class)
        if specificity:
            return (pseudo_class, specificity)
    raise ParseError(tokens[0], u'invalid    @page    selector')
