Dealing with the new device issue after logging in

Whenever I saw form that requires the ZIP for verification using mechanizer, I would enter the zip and submit the form. This however always resulted in a Mechanize::ResponseCodeError with this as the first entry of the backtrace:
Mechanize::ResponseCodeError: 500 => Net::HTTPInternalServerError for https://sellercentral.amazon.com/ap/dcq -- unhandled response

Then if I tried to log in again, everything would work just fine. So my patch checks for the verification page, submits the zip and if the expected exception is raised, I log in again. I raise the error if the login fails after the third attempt.