'Return stdout and stderr of the child process.
Interact with process: Send the \'input\' argument to stdin.
The function waits until the process terminates and reads from
stdout and stderr.
:param input: string representing the input which should be sent
to the child process. If this value is None, then nothing is passed
as stdin for the child process.'

def communicate(self, input=None):

    if input:
        self._stdin_write(input)
        self.stdin.close()
    stdout = self._pipe_stdout.nonblocking_read(self._BUFSIZE)
    stderr = self._pipe_stderr.nonblocking_read(self._BUFSIZE)
    self.wait()
    if (stdout is None):
        self._pipe_stdout.wait_for_read()
        stdout = self._get_result_namedpipe(self._pipe_stdout)
    if (stderr is None):
        self._pipe_stderr.wait_for_read()
        stderr = self._get_result_namedpipe(self._pipe_stderr)
    self._pipe_stdout.close_all_handles()
    self._pipe_stdout = None
    self._pipe_stderr.close_all_handles()
    self._pipe_stderr = None
    return (stdout, stderr)
