def _do_if(self, rule, p_selectors, p_parents, p_children, scope, media, c_lineno, c_property, c_codestr, code, name):
        """
        Implements @if and @else if
        """
        if code != '@if':
            if '@if' not in rule[OPTIONS]:
                log.error("@else with no @if (%s)", rule[INDEX][rule[LINENO]])
            val = not rule[OPTIONS].get('@if', True)
            name = c_property[9:].strip()
        else:
            val = True
        if val:
            val = self.calculate(name, rule[CONTEXT], rule[OPTIONS], rule)
            val = bool(False if not val or val in('0', 'false',) or (isinstance(
                val, basestring) and _variable_re.match(val)) else val)
            if val:
                rule[CODESTR] = c_codestr
                self.manage_children(
                    rule, p_selectors, p_parents, p_children, scope, media)
            rule[OPTIONS]['@if'] = val
Implements @if and @else if