code: def scp_transmit_file(file, remote_host_names, ssh_port=None):
      if ssh_port:
          mkdir_command_format = (
              "ssh -p {port} {host} 'mkdir -p {file_dir}'"
          )
          scp_command_format = "scp -P {port} {file} {host}:{file}"
      else:
          mkdir_command_format = "ssh {host} 'mkdir -p {file_dir}'"
          scp_command_format = "scp {file} {host}:{file}"
  
      commands = []
      for host in remote_host_names:
          mkdir_command = mkdir_command_format.format(
              host=host, port=ssh_port, file_dir=os.path.dirname(file)
          )
          scp_command = scp_command_format.format(
              host=host, file=file, port=ssh_port
          )
          commands.append(mkdir_command + " && " + scp_command)
  
      scp_exit_codes = execute_function_multithreaded(
          exec_command, commands
      )
  
      scp_successful_to_all_hosts = True
      for index, ssh_status in scp_exit_codes.items():
          exit_code, output_msg = ssh_status[0], ssh_status[1]
          if exit_code != 0:
              print(
                  "scp not successful for host {host}:\n{msg_output}".format(
                      host=remote_host_names[index],
                      msg_output=output_msg,
                  )
              )
  
              scp_successful_to_all_hosts = False
      if not scp_successful_to_all_hosts:
          exit(1)
      return True
  
file_path: bluefog/bluefog/run/network_util.py
imports: import concurrent.futures
  import io
  import os
  import re
  import socket
  import psutil
  from bluefog.run.horovodrun.common.util import safe_shell_exec
label_desc: Use image node_id 9 for calling a global function with example usage: scp_transmit_file(file, remote_host_names, ssh_port) and returns: True