code: def render_source(output_dir, package_spec, jenv=JENV):
    
    path, module_name = package_spec.filepath
    java_template = jenv.get_template(TEMPLATE_NAME)
    module_path = "com." + package_spec.identifier
    yaml_filepath = "/".join(package_spec.filepath) + ".yaml"
    includes = [".".join(i.split(".")[:-1]) for i in package_spec.includes]
    includes = [i for i in includes if i != "types"]
    for msg in package_spec.definitions:
      msg_name = classnameify(msg.identifier) if msg.sbp_id else msg.identifier
      l = "/".join(package_spec.filepath)
      destination_filename = "%s/com/%s/%s.java" % (output_dir, l , msg_name)
  
      # Create the output directory if it doesn't exist
      if not os.path.exists(os.path.dirname(destination_filename)):
        os.mkdir(os.path.dirname(destination_filename))
  
      with open(destination_filename, 'w+') as f:
          print(destination_filename)
          f.write(java_template.render(m=msg,
                                       filepath=yaml_filepath,
                                       module_path=module_path,
                                       include=includes,
                                       description=package_spec.description))
docs: Render and output