Returns the stdout as a byte stream in a Py2/PY3 compatible manner

    Returns
    -------
    io.BytesIO
        Byte stream of Stdout

def stdout():
    """
    Returns the stdout as a byte stream in a Py2/PY3 compatible manner

    Returns
    -------
    io.BytesIO
        Byte stream of Stdout
    """

    # We write all of the data to stdout with bytes, typically io.BytesIO. stdout in Python2
    # accepts bytes but Python3 does not. This is due to a type change on the attribute. To keep
    # this consistent, we leave Python2 the same and get the .buffer attribute on stdout in Python3
    byte_stdout = sys.stdout

    if sys.version_info.major > 2:
        byte_stdout = sys.stdout.buffer  # pylint: disable=no-member

    return byte_stdout