Factor out time doubling retry logic into a single function, keep_trying()

See the docstring of keep_trying() for more information.  The basic idea is
   that the function tries something, and if one of the given exceptions is
   raised, it prints an error message, sleeps, and then tries again.  The time
   slept doubles with each failure, in order to prevent DoS.  It also supports
   doing additional error handling when the error is caught.

   Note that I haven't tested all the behavior yet.  In particular, I am
   currently at my GitHub API quota, so I can't test that the code to fail
   gracefully when a pull request is really an issue works.  If someone can
   try `sympy-bot review 1778` with this, that should tell you.

   I also didn't test that it does the right thing if the reviews site is over
   quota, though I probably should.  I'm not sure what the best way to test
   that would be.