code: def link_with_parents(self, parent, c_selectors, c_rules):
          parent_found = None
          for p_selectors, p_rules in self.parts.items():
              _p_selectors, _, _ = p_selectors.partition(' extends ')
              _p_selectors = _p_selectors.split(',')
              new_selectors = set()
              found = False
              for p_selector in _p_selectors:
                  if parent in p_selector:
                      for c_selector in c_selectors.split(','):
                          _c_selector, _parent = c_selector, parent
                          lcp = self.longest_common_prefix(_c_selector, _parent)
                          if lcp:
                              _c_selector = _c_selector[lcp:]
                              _parent = _parent[lcp:]
                          lcs = self.longest_common_suffix(_c_selector, _parent)
                          if lcs:
                              _c_selector = _c_selector[:-lcs]
                              _parent = _parent[:-lcs]
                          if _c_selector and _parent:
                              prev_symbol = '(?<![
                                  0] in ('
                              post_symbol = r'(?![-\w])'
                              new_parent = re.sub(prev_symbol + _parent +
                                                  post_symbol, _c_selector, p_selector)
                              if p_selector != new_parent:
                                  new_selectors.add(new_parent)
                                  found = True
              if found:
                  parent_found = parent_found or []
                  parent_found.extend(p_rules)
              if new_selectors:
                  new_selectors = self.normalize_selectors(
                      p_selectors, new_selectors)
                  if new_selectors != p_selectors:
                      del self.parts[p_selectors]
                      self.parts.setdefault(new_selectors, [])
                      self.parts[new_selectors].extend(p_rules)
                  deps = set()
                  for c_rule in c_rules or []:
                      c_rule[SELECTORS] = c_selectors
                      deps.add(c_rule[POSITION])
                  for p_rule in p_rules:
                      p_rule[SELECTORS] = new_selectors
                      p_rule[DEPS].update(
                          deps)
          return parent_found