docs: def gen_bash_vars(job_input_file, job_homedir=None, check_name_collision=True):
      """
      :param job_input_file: path to a JSON file describing the job inputs
      :param job_homedir: path to home directory, used for testing purposes
      :param check_name_collision: should we check for name collisions?
      :return: list of lines
      :rtype: list of strings
  
      Calculates a line for each shell variable to instantiate.
      If *check_name_collision* is true, then detect and warn about
      collisions with essential environment variables.
      """
      file_key_descs, rest_hash = analyze_bash_vars(job_input_file, job_homedir)
  
      def string_of_elem(elem):
          result = None
          if isinstance(elem, basestring):
              result = elem
          elif isinstance(elem, dxpy.DXFile):
              result = json.dumps(dxpy.dxlink(elem))
          else:
              result = json.dumps(elem)
          return pipes.quote(result)
  
      def string_of_value(val):
          if isinstance(val, list):
              string = " ".join([string_of_elem(vitem) for vitem in val])
              return "( {} )".format(string)
          else:
              return string_of_elem(val)
  
      var_defs_hash = {}
  
      def gen_text_line_and_name_collision(key, val):
          ''' In the absence of a name collision, create a line describing a bash variable.
          '''
          if check_name_collision:
              if key not in environ and key not in var_defs_hash:
                  var_defs_hash[key] = val
              else:
                  sys.stderr.write(dxpy.utils.printing.fill(
                      "Creating environment variable ({}) would cause a name collision".format(key)
                  ) + "\n")
          else:
              var_defs_hash[key] = val
  
      # Processing non-file variables before the file variables. This priorities them,
      # so that in case of name collisions, the file-variables will be dropped.
      for key, desc in list(rest_hash.items()):
          gen_text_line_and_name_collision(key, string_of_value(desc))
      for file_key, desc in list(file_key_descs.items()):
          gen_text_line_and_name_collision(file_key, string_of_value(desc['handler']))
          gen_text_line_and_name_collision(file_key + "_name", string_of_value(desc['basename']))
          gen_text_line_and_name_collision(file_key + "_prefix", string_of_value(desc['prefix']))
          gen_text_line_and_name_collision(file_key + "_path", string_of_value(desc['path']))
  
      return var_defs_hash