# Path: rlp/exceptions.py
# class DeserializationError(RLPException):
#     """Exception raised if deserialization fails.
# 
#     :ivar serial: the decoded RLP string that could not be deserialized
#     """
# 
#     def __init__(self, message, serial):
#         super(DeserializationError, self).__init__(message)
#         self.serial = serial
# 
# class SerializationError(RLPException):
#     """Exception raised if serialization fails.
# 
#     :ivar obj: the object that could not be serialized
#     """
# 
#     def __init__(self, message, obj):
#         super(SerializationError, self).__init__(message)
#         self.obj = obj


from rlp.exceptions import (
    DeserializationError,
    SerializationError,
)


class Boolean:
    """A sedes for booleans
    """
    def serialize(self, obj):
        if not isinstance(obj, bool):
            raise SerializationError('Can only serialize integers', obj)

        if obj is False:
            return b''
        elif obj is True:
            return b'\x01'
        else:
            raise Exception("Invariant: no other options for boolean values")

    def deserialize(self, serial):
        if serial == b'':
            return False
        elif serial == b'\x01':
            return True
        else:

# Path: rlp/exceptions.py
# class DeserializationError(RLPException):
#     """Exception raised if deserialization fails.
# 
#     :ivar serial: the decoded RLP string that could not be deserialized
#     """
# 
#     def __init__(self, message, serial):
#         super(DeserializationError, self).__init__(message)
#         self.serial = serial
# 
# class SerializationError(RLPException):
#     """Exception raised if serialization fails.
# 
#     :ivar obj: the object that could not be serialized
#     """
# 
#     def __init__(self, message, obj):
#         super(SerializationError, self).__init__(message)
#         self.obj = obj


# Path: rlp/sedes/boolean.py
from rlp.exceptions import (
    DeserializationError,
    SerializationError,
)



class Boolean:
    """A sedes for booleans
    """
    def serialize(self, obj):
        if not isinstance(obj, bool):
            raise SerializationError('Can only serialize integers', obj)

        if obj is False:
            return b''
        elif obj is True:
            return b'\x01'
        else:
            raise Exception("Invariant: no other options for boolean values")

    def deserialize(self, serial):
        if serial == b'':
            return False
        elif serial == b'\x01':
            return True
        else:

            raise DeserializationError(