docs: def __write_docker_compose(path, docker_compose, already_existed):
      '''
      Write docker-compose to a path
      in order to use it with docker-compose ( config check )
  
      :param path:
  
      docker_compose
          contains the docker-compose file
  
      :return:
      '''
      if path.lower().endswith(('.yml', '.yaml')):
          file_path = path
          dir_name = os.path.dirname(path)
      else:
          dir_name = path
          file_path = os.path.join(dir_name, DEFAULT_DC_FILENAMES[0])
      if os.path.isdir(dir_name) is False:
          os.mkdir(dir_name)
      try:
          with salt.utils.files.fopen(file_path, 'w') as fl:
              fl.write(salt.utils.stringutils.to_str(docker_compose))
      except EnvironmentError:
          return __standardize_result(False,
                                      'Could not write {0}'.format(file_path),
                                      None, None)
      project = __load_project_from_file_path(file_path)
      if isinstance(project, dict):
          if not already_existed:
              os.remove(file_path)
          return project
      return file_path