def Generate(self, project_configuration, output_writer):
    python_module_path = os.path.join(
        self._projects_directory, project_configuration.library_name,
        project_configuration.python_module_name)

    # TODO: generate pyX-python2/Makefile.am and pyX-python3/Makefile.am

    if not os.path.exists(python_module_path):
      return

    codepage_header_file = os.path.join(
        python_module_path, u'{0:s}_codepage.h'.format(
            project_configuration.python_module_name))

    template_mappings = project_configuration.GetTemplateMappings()

    # Used to align source in pyyal/pyyal_file_object_io_handle.c
    alignment_padding = len(project_configuration.library_name) - 6
    template_mappings[u'alignment_padding'] = u' ' * alignment_padding

    for directory_entry in os.listdir(self._template_directory):
      if not directory_entry.startswith(u'pyyal_'):
        continue

      if (directory_entry.endswith(u'_codepage.h') and
          not os.path.exists(codepage_header_file)):
        continue

      template_filename = os.path.join(
          self._template_directory, directory_entry)
      if not os.path.isfile(template_filename):
        continue

      output_filename = u'{0:s}_{1:s}'.format(
          project_configuration.python_module_name, directory_entry[6:])
      output_filename = os.path.join(
          project_configuration.python_module_name, output_filename)
      if not os.path.exists(output_filename):
        continue

      self._GenerateSection(
          template_filename, template_mappings, output_writer, output_filename)
Generates Python module source files.
dataset/ETHPy150Open libyal/libyal/scripts/source-generate.py/PythonModuleSourceFileGenerator.Generate