'Parse a ruleset: a selector followed by declaration block.
:param first_token:
The first token of the ruleset (probably of the selector).
You may have read it already to distinguish the rule
from an at-rule.
:param tokens:
an iterator of subsequent tokens. Will be consumed just enough
for one ruleset.
:return:
a tuple of a :class:`RuleSet` and an error list.
The errors are recovered :class:`~.parsing.ParseError` in declarations.
(Parsing continues from the next declaration on such errors.)
:raises:
:class:`~.parsing.ParseError` if the selector is invalid for the
core grammar.
Note a that a selector can be valid for the core grammar but
not for CSS 2.1 or another level.'

def parse_ruleset(self, first_token, tokens):

    selector = []
    for token in chain([first_token], tokens):
        if (token.type == u'{'):
            selector = strip_whitespace(selector)
            if (not selector):
                raise ParseError(first_token, u'empty    selector')
            for selector_token in selector:
                validate_any(selector_token, u'selector')
            (declarations, errors) = self.parse_declaration_list(token.content)
            ruleset = RuleSet(selector, declarations, first_token.line, first_token.column)
            return (ruleset, errors)
        else:
            selector.append(token)
    raise ParseError(token, u'no    declaration    block    found    for    ruleset')
