<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def generate_api_doc(self, uri):
        '''Make autodoc documentation template string for a module

        Parameters
        ----------
        uri : string
            python location of module - e.g 'sphinx.builder'

        Returns
        -------
        head : string
            Module name, table of contents.
        body : string
            Function and class docstrings.
        '''
        # get the names of all classes and functions
        functions, classes = self._parse_module_with_import(uri)
        if not len(functions) and not len(classes) and DEBUG:
            print('WARNING: Empty -', uri)  # dbg

        # Make a shorter version of the uri that omits the package name for
        # titles
        uri_short = re.sub(r'^%s\.' % self.package_name,'',uri)

        head = '.. AUTO-GENERATED FILE -- DO NOT EDIT!\n\n'
        body = ''

        # Set the chapter title to read 'module' for all modules except for the
        # main packages
        if '.' in uri_short:
            title = 'Module: :mod:`' + uri_short + '`'
            head += title + '\n' + self.rst_section_levels[2] * len(title)
        else:
            title = ':mod:`' + uri_short + '`'
            head += title + '\n' + self.rst_section_levels[1] * len(title)

        head += '\n.. automodule:: ' + uri + '\n'
        head += '\n.. currentmodule:: ' + uri + '\n'
        body += '\n.. currentmodule:: ' + uri + '\n'
        for c in classes:
            body += '\n:class:`' + c + '`\n' \
                  + self.rst_section_levels[3] * \
                  (len(c)+9) + '\n\n'
            body += '\n.. autoclass:: ' + c + '\n'
            # must NOT exclude from index to keep cross-refs working
            body += '  :members:\n' \
                  '  :undoc-members:\n' \
                  '  :show-inheritance:\n' \
                  '\n' \
                  '  .. automethod:: __init__\n\n'
        head += '.. autosummary::\n\n'
        for f in classes + functions:
            head += '   ' + f + '\n'
        head += '\n'

        for f in functions:
            # must NOT exclude from index to keep cross-refs working
            body += f + '\n'
            body += self.rst_section_levels[3] * len(f) + '\n'
            body += '\n.. autofunction:: ' + f + '\n\n'

        return head, body