code: def render_source(output_dir, package_spec):
      
      path, name = package_spec.filepath
      destination_filename = '%s/%s.proto' % (output_dir, name)
      pb_template = JENV.get_template(MESSAGES_TEMPLATE_NAME)
      includes = [include[:-5] if include.endswith('.yaml') else include for include in package_spec.includes]
      if 'types' in includes:
          includes.remove('types')
      with open(destination_filename, 'w') as f:
          f.write(pb_template.render(
              name=name,
              package=package_spec.identifier,
              messages=package_spec.definitions,
              includes=includes,
              description=package_spec.description,
          ))
docs: Render and output to a directory given a package specification.