docs: def execute(cmd, verbosityThreshold = 1, **kwargs):
      '''execute the passed in command in the shell'''
      global exectue_defaults
      opts = merge(exectue_defaults, kwargs)              # the options computed from the default options together with the passed in options.
      subopts = filterKWArgsForFunc(opts, subprocess.Popen)
      formattedCmd = cmd.format(**getFormatBindings(cmd,1))
  
      shouldPrint = opts['verbosity'] >= verbosityThreshold
      isDryrun = opts['dryrun']
  
      if shouldPrint:
          msg = "would execute:" if isDryrun else "executing:"
          pre = "("+subopts['cwd']+")" if (subopts['cwd'] != exectue_defaults['cwd']) else ""
          print "{pre}{msg} {formattedCmd}".format(pre=pre, formattedCmd=formattedCmd, msg=msg)
      if isDryrun:
          return (0, None, None)
  
      printStdOut = shouldPrint and opts['permitShowingStdOut']
      printStdErr = shouldPrint and opts['permitShowingStdErr']
      returnCode = 0
      if opts['captureStdOutStdErr']:
          (returnCode, stdOut, stdErr) = _AsynchronouslyGetProcessOutput(formattedCmd, printStdOut, printStdErr, **subopts)    
      else:
          subopts['stdout'] = None if printStdOut else subprocess.PIPE
          subopts['stderr'] = None if printStdErr else subprocess.PIPE
          process = subprocess.Popen(formattedCmd, **subopts)
          res = process.communicate()
          returnCode = process.returncode
          stdOut = res[0]
          stdErr = res[1]
  
      if returnCode and not opts['ignoreErrors']:
          print colored('Command {} failed with return code {}!'.format(cmd, returnCode),'red')
          sys.exit(returnCode)
      
      # always print any errors
      return (returnCode, stdOut, stdErr)