It's not immediately obvious what's happening here. There should be an `except ValueError` (we wouldn't want to catch a `MemoryError`), and a comment on what this does. Doesn't `by_id` always expect an int?