title: How do I map one range of values to another in python
body: <p>Want to do the equivalent of this, (and the inverse toByte) in python, how do you map in python?</p>
  
  <pre><code>int toInt(byte b) {
    return map(b, 0, 255, -128, 127);
  }
  </code></pre>
  
  <p>i would try</p>
  
  <pre><code>int([representation],base)-128 
  </code></pre>
  
  <p>but I don't know what representation and base are</p>