<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def new_log_files(self, name, redirect_output=True):
 """Generate partially randomized filenames for log files. Args: name (str):
 descriptive string for this log file. redirect_output (bool):
 True if files should be generated for logging stdout and stderr and false if stdout and stderr should not be redirected. If it is None, it will use the "redirect_output" Ray parameter. Returns: If redirect_output is true, this will return a tuple of two file handles. The first is for redirecting stdout and the second is for redirecting stderr. If redirect_output is false, this will return a tuple of two None objects. """

        if redirect_output is None:
            redirect_output = self._ray_params.redirect_output
        if not redirect_output:
            return None, None

        log_stdout = self._make_inc_temp(
            suffix=".out", prefix=name, directory_name=self._logs_dir)
        log_stderr = self._make_inc_temp(
            suffix=".err", prefix=name, directory_name=self._logs_dir)
        # Line-buffer the output (mode 1).
        log_stdout_file = open(log_stdout, "a", buffering=1)
        log_stderr_file = open(log_stderr, "a", buffering=1)
        return log_stdout_file, log_stderr_file