def format_pythonrunner_result(result):
    output = format_possible_failure_result(result)
    # Add in various properties if they have values
    result_ = result.get('result', None)
    if result_ is not None:
        output['result'] = result_
    stdout = result.get('stdout', None)
    if stdout:
        try:
            output['stdout'] = stdout.strip()
        except __HOLE__:
            output['stdout'] = stdout
    stderr = result.get('stderr', None)
    if stderr:
        output['stderr'] = stderr.strip()
    exit_code = result.get('exit_code', 0)
    if exit_code != 0:
        output['exit_code'] = exit_code
    return _serialize(output)
dataset/ETHPy150Open StackStorm/st2contrib/packs/hubot/actions/post_result.py/format_pythonrunner_result