code: def create_package_level_rst_index_file(
          package_name, max_depth, modules, inner_packages=None):
      
      if inner_packages is None:
          inner_packages = []
      return_text = 'Package::' + package_name
      dash = '=' * len(return_text)
      return_text += '\n' + dash + '\n\n'
      return_text += '.. toctree::' + '\n'
      return_text += '   :maxdepth: ' + str(max_depth) + '\n\n'
      upper_package = package_name.split('.')[-1]
      for module in modules:
          if module in EXCLUDED_PACKAGES:
              continue
          return_text += '   ' + upper_package + os.sep + module[:-3] + '\n'
      for inner_package in inner_packages:
          if inner_package in EXCLUDED_PACKAGES:
              continue
          return_text += '   ' + upper_package + os.sep + inner_package + '\n'
  
      return return_text
docs: Function for creating text for index for a package.
  
      :param package_name: name of the package
      :type package_name: str
  
      :param max_depth: Value for max_depth in the index file.
      :type max_depth: int
  
      :param modules: list of module in the package.
      :type modules: list
  
      :return: A text for the content of the index file.
      :rtype: str