docs: def _rule_as_string(self, rule):
          """
          Converts a tinycss rule to a formatted CSS string
  
          :param rule: The rule to format
          :type rule: tinycss Rule object
          :returns: The Rule as a CSS string
          :rtype: str
          """
          if isinstance(rule, RuleSet):
              # Simple CSS rule : a { color: red; }
              return '%s{%s}' % (
                  self._selector_as_string(rule.selector),
                  self._declarations_as_string(rule.declarations))
  
          elif isinstance(rule, ImportRule):
              # @import rule
              return "@import url('%s') %s;" % (
                  rule.uri, ','.join(rule.media))
  
          elif isinstance(rule, FontFaceRule):
              # @font-face rule
              return "@font-face{%s}" % self._declarations_as_string(rule.declarations)
  
          elif isinstance(rule, MediaRule):
              # @media rule
              return "@media %s{%s}" % (
                  ','.join(rule.media),
                  ''.join(self._rule_as_string(r) for r in rule.rules))
  
          elif isinstance(rule, PageRule):
              # @page rule
              selector, pseudo = rule.selector
  
              return "@page%s%s{%s}" % (
                  ' %s' % selector if selector else '',
                  ' :%s' % pseudo if pseudo else '',
                  self._declarations_as_string(rule.declarations))
  
          return ''