code: def _generate_properties_file(
      model: DJLModel,
      code_dir: Path,
      overwrite_props_from_file: bool,
      manual_set_props: dict,
  ):
      """Construct serving properties file taking into account of overrides or manual specs"""
      if _has_serving_properties_file(code_dir):
          existing_properties = _read_existing_serving_properties(
              code_dir
          )
      else:
          existing_properties = {}
  
      serving_properties_dict = model.generate_serving_properties()
      serving_properties_file = code_dir.joinpath(
          _SERVING_PROPERTIES_FILE
      )
  
      with open(serving_properties_file, mode="w+") as file:
          covered_keys = set()
  
          if manual_set_props:
              for key, value in manual_set_props.items():
                  logger.info(
                      _SETTING_PROPERTY_STMT, key, value.strip()
                  )
                  covered_keys.add(key)
                  file.write(f"{key}={value}")
  
          for key, value in serving_properties_dict.items():
              if not overwrite_props_from_file:
                  logger.info(_SETTING_PROPERTY_STMT, key, value)
                  file.write(f"{key}={value}\n")
              else:
                  existing_property = existing_properties.get(key)
                  covered_keys.add(key)
                  if not existing_property:
                      logger.info(_SETTING_PROPERTY_STMT, key, value)
                      file.write(f"{key}={value}\n")
                  else:
                      logger.info(
                          _SETTING_PROPERTY_STMT,
                          key,
                          existing_property.strip(),
                      )
                      file.write(f"{key}={existing_property}")
  
          if overwrite_props_from_file:
              # for addition provided properties
              for key, value in existing_properties.items():
                  if key not in covered_keys:
                      logger.info(
                          _SETTING_PROPERTY_STMT, key, value.strip()
                      )
                      file.write(f"{key}={value}")
  
imports: from __future__ import absolute_import
  import shutil
  import json
  import tarfile
  import logging
  from typing import List
  from pathlib import Path
  from sagemaker.utils import _tmpdir
  from sagemaker.s3 import S3Downloader
  from sagemaker.djl_inference import DJLModel
  from sagemaker.djl_inference.model import _read_existing_serving_properties
  from sagemaker.serve.utils.local_hardware import _check_disk_space, _check_docker_disk_usage
label_desc: Use image node_id 5 for calling a global function with example usage: _generate_properties_file(model, code_dir, overwrite_props_from_file, manual_set_props) without return types