Add configurable operation retries

* The original retry count has become a module constant
  `DEFAULT_RETRY_COUNT`.
* The configured number of retries is a thread-local, meaning that it
  remains safe even in threaded applications. It can be set using
  `client.retries` or for the scope of with statement invoking
  `client.retry_count` with the desired number of retries as the only
  argument.
* Added a section to the docs about the retry logic.

cc @martinsumner