# Buggy code
def _deserialize(self, value, attr, data, **kwargs):  # pylint: disable=unused-argument
    if not is_0x_prefixed(value):
        self.fail("missing_prefix")

    if not is_checksum_address(value):
        self.fail("invalid_checksum")

    try:
        value = to_canonical_address(value)
    except ValueError:
        self.fail("invalid_data")

    if len(value) != 20:
        self.fail("invalid_size")

    return value


# Traceback (ValueError)
2019-11-04 14:09:33.074227 [critical ] Unhandled exception when processing endpoint request [raiden.api.rest] node=0xf5eAE6E37B2873D32E11C88E310956D3C9c712f0
Traceback (most recent call last):
File "flask/app.py", line 1832, in full_dispatch_request
File "flask/app.py", line 1818, in dispatch_request
File "flask_restful/__init__.py", line 458, in wrapper
File "flask/views.py", line 88, in view
File "flask_restful/__init__.py", line 573, in dispatch_request
File "webargs/core.py", line 464, in wrapper
File "raiden/api/v1/resources.py", line 57, in put
File "raiden/api/rest.py", line 652, in open
File "raiden/api/python.py", line 450, in channel_open
File "raiden/api/python.py", line 350, in is_already_existing_channel
File "raiden/network/proxies/token_network.py", line 435, in get_channel_identifier_or_none
File "raiden/network/proxies/token_network.py", line 409, in get_channel_identifier
File "raiden/network/proxies/token_network.py", line 96, in raise_if_invalid_address_pair
ValueError: The null address is not allowed as a channel participant.
2019-11-04 14:09:34.077496 [info     ] 127.0.0.1 - - [2019-11-04 15:09:34] "PUT /api/v1/channels HTTP/1.1" 500 161 1.212333 [raiden.api.rest.pywsgi]
Traceback (most recent call last):
File "src/gevent/greenlet.py", line 716, in gevent._greenlet.Greenlet.run
File "raiden/api/rest.py", line 437, in _run
File "gevent/baseserver.py", line 364, in serve_forever
File "src/gevent/event.py", line 240, in gevent._event.Event.wait
File "src/gevent/event.py", line 140, in gevent._event._AbstractLinkable._wait
File "src/gevent/event.py", line 117, in gevent._event._AbstractLinkable._wait_core
File "src/gevent/event.py", line 119, in gevent._event._AbstractLinkable._wait_core
File "src/gevent/_greenlet_primitives.py", line 59, in gevent.__greenlet_primitives.SwitchOutGreenletWithLoop.switch
File "src/gevent/_greenlet_primitives.py", line 59, in gevent.__greenlet_primitives.SwitchOutGreenletWithLoop.switch
File "src/gevent/_greenlet_primitives.py", line 63, in gevent.__greenlet_primitives.SwitchOutGreenletWithLoop.switch
File "src/gevent/__greenlet_primitives.pxd", line 35, in gevent.__greenlet_primitives._greenlet_switch
ValueError: The null address is not allowed as a channel participant.
2019-11-04T14:09:34Z <Greenlet "APIServer|Greenlet-4" at 0x7f3b9da91170: <bound method APIServer._run of <raiden.api.rest.APIServer object at 0x7f3b9e17efd0>>> failed with ValueError

FATAL: An unexpected exception occured. A traceback has been written to /tmp/raiden-exception-2019-11-04T14-09u_e2bh08.txt
The null address is not allowed as a channel participant.
2019-11-04 14:09:34.332260 [info     ] Raiden stopped                 [raiden.app] node=0xf5eAE6E37B2873D32E11C88E310956D3C9c712f0
Traceback (most recent call last):
File "src/gevent/greenlet.py", line 716, in gevent._greenlet.Greenlet.run
File "raiden/ui/runners.py", line 229, in stop_task
File "src/gevent/greenlet.py", line 633, in gevent._greenlet.Greenlet.get
File "src/gevent/greenlet.py", line 312, in gevent._greenlet.Greenlet._raise_exception
File "gevent/_compat.py", line 47, in reraise
File "src/gevent/greenlet.py", line 716, in gevent._greenlet.Greenlet.run
File "raiden/api/rest.py", line 437, in _run
File "gevent/baseserver.py", line 364, in serve_forever
File "src/gevent/event.py", line 240, in gevent._event.Event.wait
File "src/gevent/event.py", line 140, in gevent._event._AbstractLinkable._wait
File "src/gevent/event.py", line 117, in gevent._event._AbstractLinkable._wait_core
File "src/gevent/event.py", line 119, in gevent._event._AbstractLinkable._wait_core
File "src/gevent/_greenlet_primitives.py", line 59, in gevent.__greenlet_primitives.SwitchOutGreenletWithLoop.switch
File "src/gevent/_greenlet_primitives.py", line 59, in gevent.__greenlet_primitives.SwitchOutGreenletWithLoop.switch
File "src/gevent/_greenlet_primitives.py", line 63, in gevent.__greenlet_primitives.SwitchOutGreenletWithLoop.switch
File "src/gevent/__greenlet_primitives.pxd", line 35, in gevent.__greenlet_primitives._greenlet_switch
ValueError: The null address is not allowed as a channel participant.
2019-11-04T14:09:34Z <Greenlet "Greenlet-3" at 0x7f3b9e29dcb0: stop_task(<raiden.api.rest.APIServer object at 0x7f3b9e17efd)> failed with ValueError

Traceback (most recent call last):
File "raiden-script.py", line 2, in <module>
File "raiden/__main__.py", line 13, in main
File "click/core.py", line 764, in __call__
File "click/core.py", line 717, in main
File "click/core.py", line 1114, in invoke
File "click/core.py", line 956, in invoke
File "click/core.py", line 555, in invoke
File "click/decorators.py", line 17, in new_func
File "raiden/ui/cli.py", line 568, in run
File "raiden/ui/runners.py", line 243, in run
File "raiden/ui/runners.py", line 234, in _start_services
File "src/gevent/greenlet.py", line 849, in gevent._greenlet.joinall
File "src/gevent/greenlet.py", line 865, in gevent._greenlet.joinall
File "src/gevent/greenlet.py", line 312, in gevent._greenlet.Greenlet._raise_exception
File "gevent/_compat.py", line 47, in reraise
File "src/gevent/greenlet.py", line 716, in gevent._greenlet.Greenlet.run
File "raiden/ui/runners.py", line 229, in stop_task
File "src/gevent/greenlet.py", line 633, in gevent._greenlet.Greenlet.get
File "src/gevent/greenlet.py", line 312, in gevent._greenlet.Greenlet._raise_exception
File "gevent/_compat.py", line 47, in reraise
File "src/gevent/greenlet.py", line 716, in gevent._greenlet.Greenlet.run
File "raiden/api/rest.py", line 437, in _run
File "gevent/baseserver.py", line 364, in serve_forever
File "src/gevent/event.py", line 240, in gevent._event.Event.wait
File "src/gevent/event.py", line 140, in gevent._event._AbstractLinkable._wait
File "src/gevent/event.py", line 117, in gevent._event._AbstractLinkable._wait_core
File "src/gevent/event.py", line 119, in gevent._event._AbstractLinkable._wait_core
File "src/gevent/_greenlet_primitives.py", line 59, in gevent.__greenlet_primitives.SwitchOutGreenletWithLoop.switch
File "src/gevent/_greenlet_primitives.py", line 59, in gevent.__greenlet_primitives.SwitchOutGreenletWithLoop.switch
File "src/gevent/_greenlet_primitives.py", line 63, in gevent.__greenlet_primitives.SwitchOutGreenletWithLoop.switch
File "src/gevent/__greenlet_primitives.pxd", line 35, in gevent.__greenlet_primitives._greenlet_switch
ValueError: The null address is not allowed as a channel participant.
[17657] Failed to execute script raiden-script

# Fixed code
def _deserialize(self, value, attr, data, **kwargs):  # pylint: disable=unused-argument
    if not is_0x_prefixed(value):
        self.fail("missing_prefix")

    if not is_checksum_address(value):
        self.fail("invalid_checksum")

    try:
        value = to_canonical_address(value)
    except ValueError:
        self.fail("invalid_data")

    if len(value) != 20:
        self.fail("invalid_size")

    if value == NULL_ADDRESS_BYTES:
        self.fail("null_address")

    return value