code: def deploy_files(
      conn, root_dir, opts, master_nodes, slave_nodes, modules
  ):
      active_master = get_dns_name(master_nodes[0], opts.private_ips)
  
      num_disks = get_num_disks(opts.instance_type)
      hdfs_data_dirs = "/mnt/ephemeral-hdfs/data"
      mapred_local_dirs = "/mnt/hadoop/mrlocal"
      spark_local_dirs = "/mnt/spark"
      if num_disks > 1:
          for i in range(2, num_disks + 1):
              hdfs_data_dirs += ",/mnt%d/ephemeral-hdfs/data" % i
              mapred_local_dirs += ",/mnt%d/hadoop/mrlocal" % i
              spark_local_dirs += ",/mnt%d/spark" % i
  
      cluster_url = "%s:7077" % active_master
  
      if "." in opts.spark_version:
          # Pre-built Spark deploy
          spark_v = get_validate_spark_version(
              opts.spark_version, opts.spark_git_repo
          )
          tachyon_v = get_tachyon_version(spark_v)
      else:
          # Spark-only custom deploy
          spark_v = "%s|%s" % (opts.spark_git_repo, opts.spark_version)
          tachyon_v = ""
          print("Deploying Spark via git hash; Tachyon won't be set up")
          modules = filter(lambda x: x != "tachyon", modules)
  
      master_addresses = [
          get_dns_name(i, opts.private_ips) for i in master_nodes
      ]
      slave_addresses = [
          get_dns_name(i, opts.private_ips) for i in slave_nodes
      ]
      worker_instances_str = (
          "%d" % opts.worker_instances if opts.worker_instances else ""
      )
      template_vars = {
          "master_list": "\n".join(master_addresses),
          "active_master": active_master,
          "slave_list": "\n".join(slave_addresses),
          "cluster_url": cluster_url,
          "hdfs_data_dirs": hdfs_data_dirs,
          "mapred_local_dirs": mapred_local_dirs,
          "spark_local_dirs": spark_local_dirs,
          "swap": str(opts.swap),
          "modules": "\n".join(modules),
          "spark_version": spark_v,
          "tachyon_version": tachyon_v,
          "hadoop_major_version": opts.hadoop_major_version,
          "spark_worker_instances": worker_instances_str,
          "spark_master_opts": opts.master_opts,
      }
  
      if opts.copy_aws_credentials:
          template_vars["aws_access_key_id"] = conn.aws_access_key_id
          template_vars[
              "aws_secret_access_key"
          ] = conn.aws_secret_access_key
      else:
          template_vars["aws_access_key_id"] = ""
          template_vars["aws_secret_access_key"] = ""
  
      # Create a temp directory in which we will place all the files to be
      # deployed after we substitue template parameters in them
      tmp_dir = tempfile.mkdtemp()
      for path, dirs, files in os.walk(root_dir):
          if path.find(".svn") == -1:
              dest_dir = os.path.join("/", path[len(root_dir) :])
              local_dir = tmp_dir + dest_dir
              if not os.path.exists(local_dir):
                  os.makedirs(local_dir)
              for filename in files:
                  if filename[0] not in "#.~" and filename[-1] != "~":
                      dest_file = os.path.join(dest_dir, filename)
                      local_file = tmp_dir + dest_file
                      with open(os.path.join(path, filename)) as src:
                          with open(local_file, "w") as dest:
                              text = src.read()
                              for key in template_vars:
                                  text = text.replace(
                                      "{{" + key + "}}",
                                      template_vars[key],
                                  )
                              dest.write(text)
                              dest.close()
      # rsync the whole directory over to the master machine
      command = [
          "rsync",
          "-rv",
          "-e",
          stringify_command(ssh_command(opts)),
          "%s/" % tmp_dir,
          "%s@%s:/" % (opts.user, active_master),
      ]
      subprocess.check_call(command)
      # Remove the temp directory we created above
      shutil.rmtree(tmp_dir)
  
imports: from __future__ import division, print_function, with_statement
  import codecs
  import hashlib
  import itertools
  import logging
  import os
  import os.path
  import pipes
  import random
  import shutil
  import string
  from stat import S_IRUSR
  import subprocess
  import sys
  import tarfile
  import tempfile
  import textwrap
  import time
  import warnings
  from datetime import datetime
  from optparse import OptionParser
  from sys import stderr
  import boto
  from boto.ec2.blockdevicemapping import BlockDeviceMapping, BlockDeviceType, EBSBlockDeviceType
  from boto import ec2
label_desc: Use image node_id 16 for calling a global function with example usage: deploy_files(conn, root_dir, opts, master_nodes, slave_nodes, modules) without return types