docs: def write_config_files(out_dir='.',
                         java_home_dir=None,
                         jvm_dll_file=None,
                         install_dir=None,
                         req_java_api_conf=True,
                         req_py_api_conf=True):
      """
      Writes the jpy configuration files for Java and/or Python.
  
      :param out_dir: output directory, must exist
      :param java_home_dir: optional home directory of the Java JRE or JDK installation
      :param jvm_dll_file: optional file to JVM shared library file
      :param install_dir: optional path to where to searfh for modules
      :param req_java_api_conf: whether to write the jpy configuration file 'jpyconfig.properties' for Java
      :param req_py_api_conf: whether to write the jpy configuration file 'jpyconfig.py' for Python
      :return: zero on success, otherwise an error code
      """
      import datetime
  
      retcode = 0
  
      tool_name = os.path.basename(__file__)
  
      py_api_config_basename = 'jpyconfig.py'
      java_api_config_basename = 'jpyconfig.properties'
  
      if not jvm_dll_file:
          jvm_dll_file = find_jvm_dll_file(java_home_dir=java_home_dir)
      if jvm_dll_file:
          py_api_config_file = os.path.join(out_dir, py_api_config_basename)
          try:
              with open(py_api_config_file, 'w') as f:
                  f.write("# Created by '%s' tool on %s\n" % (tool_name, str(datetime.datetime.now())))
                  f.write(
                      "# This file is read by the 'jpyutil' module in order to load and configure the JVM from Python\n")
                  if java_home_dir:
                      f.write('java_home = %s\n' % repr(java_home_dir))
                  f.write('jvm_dll = %s\n' % repr(jvm_dll_file))
                  f.write('jvm_maxmem = None\n')
                  f.write('jvm_classpath = []\n')
                  f.write('jvm_properties = {}\n')
                  f.write('jvm_options = []\n')
              logger.info("jpy Python API configuration written to '%s'" % py_api_config_file)
          except Exception:
              logger.exception("Error while writing Python API configuration")
              if req_py_api_conf:
                  retcode = 1
      else:
          logger.error("Can't determine any JVM shared library")
          if req_py_api_conf:
              retcode = 2
  
      try:
          java_api_config_file = os.path.join(out_dir, java_api_config_basename)
          java_api_properties = _get_java_api_properties(fail=req_java_api_conf, path=install_dir)
          java_api_properties.store(java_api_config_file, comments=[
              "Created by '%s' tool on %s" % (tool_name, str(datetime.datetime.now())),
              "This file is read by the jpy Java API (org.jpy.PyLib class) in order to find shared libraries"])
          logger.info("jpy Java API configuration written to '%s'" % java_api_config_file)
      except Exception:
          logger.exception("Error while writing Java API configuration")
          if req_java_api_conf:
              retcode = 3
  
      return retcode