<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def redirectSTDOUTtoDebugFile():
 """Redirects the stdout and stderr of the current process to a file."""

    import sys
    kwargs = {}
    if sys.version_info >= (3,):
        kwargs["encoding"] = "utf8"
    sys.stdout = open(
        os.path.join(
            getDebugDirectory(),
            "{0}.stdout".format(getDebugIdentifier()),
        ),
        "w",
        1, # Buffering by line
        **kwargs
    )
    sys.stderr = open(
        os.path.join(
            getDebugDirectory(),
            "{0}.stderr".format(getDebugIdentifier()),
        ),
        "w",
        1, # Buffering by line
        **kwargs
    )