you can just write the last `else:`  as `elif code != HTTP_ACCEPTED` and avoid this branching here