<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def output_of(*cmd: Optional[str], **kwargs) -> str: """Invokes a subprocess and returns its output as a string. Args: cmd: Components of the command to execute, e.g. ["echo", "dog"]. **kwargs: Extra arguments for asyncio.create_subprocess_shell, such as a cwd (current working directory) argument. Returns: A (captured output, captured error output, return code) triplet. The captured outputs will be None if the out or err parameters were not set to an instance of TeeCapture. Raises: subprocess.CalledProcessError: The process returned a non-zero error code and raise_on_fail was set. """

    result = cast(str, run_cmd(*cmd,
                               log_run_to_stderr=False,
                               out=TeeCapture(),
                               **kwargs).out)

    # Strip final newline.
    if result.endswith('\n'):
        result = result[:-1]

    return result