import struct


def boolean(value):
    """Encode a boolean value.

    :param bool value: Value to encode
    :rtype: bytes

    """
    if not isinstance(value, bool):
        raise TypeError('bool type required')
    return struct.pack('>B', int(value))