code: def parse_parent(docname):
      
  
      lineage = docname.split('/')
      lineage_count = len(lineage)
  
      if docname == 'index':
          # This is the top of the Sphinx project
          parent = None
      elif lineage_count == 1:
          # This is a non-index doc in root, e.g. about
          parent = 'index'
      elif lineage_count == 2 and lineage[-1] == 'index':
          # This is blog/index, parent is the root
          parent = 'index'
      elif lineage_count == 2:
          # This is blog/about
          parent = lineage[0] + '/index'
      elif lineage[-1] == 'index':
          # This is blog/sub/index
          parent = '/'.join(lineage[:-2]) + '/index'
      else:
          # This should be blog/sub/about
          parent = '/'.join(lineage[:-1]) + '/index'
  
      return parent
docs: Given a docname path, pick apart and return name of parent