function* walkRules(tree) {
  if (tree.type === 'stylesheet' && 'stylesheet' in tree && tree.stylesheet) {
    for (const rule of tree.stylesheet.rules) {
      if (rule.type === 'rule') {
        yield rule
      } else {
        yield* walkRules(rule)
      }
    }
  }
  // ignore @media, etc.
}
@param {Node} tree
  Tree.
@returns {Generator<Rule>}
  Generator.