code: def parse_sphinx_docopts(index):
      
  
      pos = index.find('var DOCUMENTATION_OPTIONS')
      if pos < 0:
          raise ValueError('Documentation options could not be found in index.')
      pos = index.find('{', pos)
      if pos < 0:
          raise ValueError('Documentation options could not be found in index.')
      endpos = index.find('};', pos)
      if endpos < 0:
          raise ValueError('Documentation options could not be found in index.')
      block = index[pos + 1:endpos].strip()
      docopts = {}
      for line in block.splitlines():
          key, value = line.split(':', 1)
          key = key.strip().strip('"')
  
          value = value.strip()
          if value[-1] == ',':
              value = value[:-1].rstrip()
          if value[0] in '"\'':
              value = value[1:-1]
          elif value == 'false':
              value = False
          elif value == 'true':
              value = True
          else:
              try:
                  value = int(value)
              except ValueError:
                  # In Sphinx 1.7.5, URL_ROOT is a JavaScript fragment.
                  # Ignoring this entry since URL_ROOT is not used
                  # elsewhere.
                  # https://github.com/sphinx-gallery/sphinx-gallery/issues/382
                  continue
  
          docopts[key] = value
  
      return docopts
docs: Parse the Sphinx index for documentation options.
  
      Parameters
      ----------
      index : str
          The Sphinx index page
  
      Returns
      -------
      docopts : dict
          The documentation options from the page.