title: How to handle return value of a function?
body: <p>I have a subprocess call function which I need to handle the return value properly. For example, I have tried to use try/except but not quite sure it's the right approach or is there any better way to handle returned value. The bash script (pair.sh) is used for bluetooth pairing. If pairing fails, then pair.sh return pair fails and this function should handle the return value at that point. </p>
  
  <pre><code>def unpair(bd_addr):
      try:
          subprocess.call(
          "timeout 10 " + test.sh + " " + bd_addr,
          shell=True
          )
      except:
          print "test script fails to run"**
  </code></pre>