code: def convert_ini(config_dict):
      
      config_lines = []
  
      for env, configs in sorted(config_dict.items()):
          for resource, app_properties in sorted(configs.items()):
              try:
                  for app_property, value in sorted(app_properties.items()):
                      variable = '{env}_{resource}_{app_property}'.format(
                          env=env, resource=resource, app_property=app_property).upper()
  
                      if isinstance(value, (dict, DeepChainMap)):
                          safe_value = "'{0}'".format(json.dumps(dict(value)))
                      else:
                          safe_value = json.dumps(value)
  
                      line = "{variable}={value}".format(variable=variable, value=safe_value)
  
                      LOG.debug('INI line: %s', line)
                      config_lines.append(line)
              except AttributeError:
                  resource = resource.upper()
                  app_properties = "'{}'".format(json.dumps(app_properties))
                  line = '{0}={1}'.format(resource, app_properties)
  
                  LOG.debug('INI line: %s', line)
                  config_lines.append(line)
      return config_lines
docs: Convert _config_dict_ into a list of INI formatted strings.
  
      Args:
          config_dict (dict): Configuration dictionary to be flattened.
  
      Returns:
          (list) Lines to be written to a file in the format of KEY1_KEY2=value.