title: Automatic discovery of master by sentinel
body: <p>A redis master can be discovered via sentinel using:</p>
  
  <pre><code>from redis.sentinel import Sentinel
  sentinel = Sentinel([('127.0.0.1', 26379)])
  master_server = sentinel.master_for('mymaster')
  </code></pre>
  
  <p>Now to write data to the master node : </p>
  
  <pre><code>master_server.setex(key, 120, value)
  # do something
  master_server.setex(key, 120, new_value)
  </code></pre>
  
  <p>Now, while <code># do something</code>, if the <code>master_server</code> crashes, <code>sentinel</code> will promote a slave to master by voting. Hence, <code>master_server.setex(key, 120, new_value)</code> will throw a <strong>MasterNotFoundError</strong>.</p>
  
  <p>A workaround is to <em>try-catch</em> this block; Is there a way such that master discovery is automatically handled by redis? Since placing <em>try-catch</em> everywhere in the code would make the code redundant and messy.</p>