code: def replace_parent(self, parent_simples):
          
          assert parent_simples
  
          ancestors = parent_simples[:-1]
          parent = parent_simples[-1]
  
          did_replace = False
          new_tokens = []
          for token in self.tokens:
              if not did_replace and token in ('&', 'self'):
                  did_replace = True
                  new_tokens.extend(parent.tokens)
                  if token == 'self':
                      warn(FutureWarning(
                          "The xCSS 'self' selector is deprecated and will be "
                          "removed in 2.0.  Use & instead.  ({0!r})"
                          .format(self)
                      ))
              else:
                  new_tokens.append(token)
  
          if not did_replace:
              # This simple selector doesn't contain a parent reference so just
              # stick it on the end
              return parent_simples + (self,)
  
          # This simple selector was merged into the direct parent.
          merged_self = type(self)(parent.combinator, new_tokens)
          selector = ancestors + (merged_self,)
          # Our combinator goes on the first ancestor, i.e., substituting "foo
          # bar baz" into "+ &.quux" produces "+ foo bar baz.quux".  This means a
          # potential conflict with the first ancestor's combinator!
          root = selector[0]
          if not _is_combinator_subset_of(self.combinator, root.combinator):
              raise ValueError(
                  "Can't sub parent {0!r} into {1!r}: "
                  "combinators {2!r} and {3!r} conflict!"
                  .format(
                      parent_simples, self, self.combinator, root.combinator))
  
          root = type(self)(self.combinator, root.tokens)
          selector = (root,) + selector[1:]
          return tuple(selector)
docs: If ``&`` (or the legacy xCSS equivalent ``self``) appears in this
          selector, replace it with the given iterable of parent selectors.
  
          Returns a tuple of simple selectors.