title: I want my Python script to detect the version and quit gracefully in case of a mismatch
body: <p>I'd like to make it as general as possible - e.g. handle as many versions as possible.</p>
  
  <p>Since version 3 is not backwards compatible with version 2, I want to make sure that I use the right print statement.</p>
  
  <p>Please let me know if you have questions and feel free to share related knowledge having to do with dynamic logic based on what (e.g. libraries) is available.</p>
  
  <p>Suppose I have a script that will run under version 1.x, or 2.x, or 3.x only.</p>
  
  <p>Or a script which requires a library A or a library B.</p>
  
  <p>Thanks!</p>
  
  <p><strong><em>EDIT:</em></strong></p>
  
  <p>Now ... when it comes to Python (unlike .Net) some libraries like SciPy, Google App Engine keep you glued to particular version. On Linux, Mac Os you can switch between different Python installs on command line. This is why I want to avoid confusion - I want to remember which script is for which version of Python and what libraries it needs. I would rather have it fail in a human-readable way.</p>