def _nest_rules(self, rule, scope, block):
        """
        Implements Nested CSS rules
        """
        calculator = self._make_calculator(rule.namespace)
        raw_selectors = calculator.do_glob_math(block.prop)
        # DEVIATION: ruby sass doesn't support bare variables in selectors
        raw_selectors = calculator.apply_vars(raw_selectors)
        c_selectors, c_parents = self.parse_selectors(raw_selectors)
        if c_parents:
            warn_deprecated(
                rule,
                "The XCSS 'a extends b' syntax is deprecated.  "
                "Use 'a { @extend b; }' instead."
            )

        new_ancestry = rule.ancestry.with_nested_selectors(c_selectors)

        rule.descendants += 1
        new_rule = SassRule(
            source_file=rule.source_file,
            import_key=rule.import_key,
            lineno=block.lineno,
            num_header_lines=block.header.num_lines,
            unparsed_contents=block.unparsed_contents,

            legacy_compiler_options=rule.legacy_compiler_options,
            options=rule.options.copy(),
            #properties
            extends_selectors=c_parents,
            ancestry=new_ancestry,

            namespace=rule.namespace.derive(),
            nested=rule.nested + 1,
        )
        self.rules.append(new_rule)
        rule.namespace.use_import(rule.source_file)
        self.manage_children(new_rule, scope)

        self._warn_unused_imports(new_rule)
Implements Nested CSS rules