title: Are there any conditional rules for voluptuous?
body: <p>Is there any way to define conditional rules using voluptuous?</p>
  
  <p>Here's the schema I have:</p>
  
  <pre><code>from voluptuous import Schema, All, Any
  
  schema = Schema({
      'resolution': All(str, Any('1920x1080', '1280x720')),
      'bitrate': 20,
  })
  </code></pre>
  
  <p>That's ok, but now I want to validate bitrate value based on resolution value. If I have <code>1920x1080</code> as resolution, than I need to be shure that bitrate is one of these values: 20, 16, 12, 8; and when it's <code>1280x720</code> then bitrate should be one of these: 10, 8, 6, 4.</p>
  
  <p>How can I do that? There's info on the <a href="https://github.com/alecthomas/voluptuous" rel="noreferrer">project's github page</a> but I can't find my case there.</p>