title: Python 3 backward compatability (shlex.quote vs pipes.quote)
body: <p>One of my projects uses <code>shlex.quote</code> which is available since <em>python 3.3</em>. But that <code>shlex.quote</code> is the same as <code>pipes.quote</code> which is deprecated after moving to shlex.</p>
  
  <p>Now for compatibility I am using this code:</p>
  
  <pre><code>def cmd_quote(string):
      import sys
      if int(sys.version[2]) &lt; 3:
          import pipes
          return pipes.quote(string)
      else:
          import shlex
          return shlex.quote(string)
  </code></pre>
  
  <p>Are any better practices exists?</p>