'Build command line to invoke this tool given a populated param_dict'

def __build_command_line(self):

    command = self.tool.command
    param_dict = self.param_dict
    interpreter = self.tool.interpreter
    command_line = None
    if (not command):
        return
    try:
        command_line = fill_template(command, context=param_dict)
        cleaned_command_line = []
        for line in command_line.split('\n'):
            cleaned_command_line.append(line.strip())
        command_line = '\n'.join(cleaned_command_line)
        command_line = command_line.replace('\n', '    ').replace('\r', '    ').strip()
    except Exception:
        raise
    if interpreter:
        executable = command_line.split()[0]
        tool_dir = os.path.abspath(self.tool.tool_dir)
        abs_executable = os.path.join(tool_dir, executable)
        command_line = command_line.replace(executable, abs_executable, 1)
        command_line = ((interpreter + '    ') + command_line)
    self.command_line = command_line
