I'm hoping there's no performance or other disadvantage in attempting to avoid long chains of conditional if/elif statements this way:
errstr = {404: "404 Not Found",
405: "405 Method Not Allowed"}
if code in errstr:
print errstr[code];