code: def ifancestor(parser, token):
      
      # Grab the contents between
      contents = parser.parse(('endifancestor',))
      parser.delete_first_token()
  
      # If there is only one argument (2 including tag name)
      # parse it as a variable
      bits = token.split_contents()
      if len(bits) == 2:
          arg = parser.compile_filter(bits[1])
      else:
          arg = None
  
      # Also pass all arguments to the original url tag
      url_node = url(parser, token)
  
      return AncestorNode(url_node, arg=arg, contents=contents)
docs: Returns the contents of the tag if the provided path consitutes the
      base of the current pages path.
  
      There are two ways to provide arguments to this tag. Firstly one may
      provide a single argument that starts with a forward slash. e.g.
  
          {% ifancestor '/path/to/page' %}...{% endifancestor}
          {% ifancestor path_variable %}...{% endifancestor}
  
      In this case the provided path will be used directly.
  
      Alternatively any arguments accepted by the standard "url" tag may
      be provided. They will be passed to the url tag and the resultant
      path will be used. e.g.
  
          {% ifancestor 'core:model:detail' model.pk %}...{% endifancestor}
  
      Ultimately the provided path is matched against the path of the
      current page. If the provided path is found at the root of the current
      path it will be considered an anscestor, and the contents of this tag
      will be rendered.