code: def _get_supervisorctl_bin(bin_env):
      '''
      Return supervisorctl command to call, either from a virtualenv, an argument
      passed in, or from the global modules options
      '''
      cmd = 'supervisorctl'
      if not bin_env:
          which_result = __salt__['cmd.which_bin']([cmd])
          if which_result is None:
              raise CommandNotFoundError(
                  'Could not find a `{0}` binary'.format(cmd)
              )
          return which_result
  
      # try to get binary from env
      if os.path.isdir(bin_env):
          cmd_bin = os.path.join(bin_env, 'bin', cmd)
          if os.path.isfile(cmd_bin):
              return cmd_bin
          raise CommandNotFoundError('Could not find a `{0}` binary'.format(cmd))
  
      return bin_enf _get_supervisorctl_bin(bin_env):
      '''
      Return supervisorctl command to call, either from a virtualenv, an argument
      passed in, or from the global modules options
      '''
      cmd = 'supervisorctl'
      if not bin_env:
          which_result = __salt__['cmd.which_bin']([cmd])
          if which_result is None:
              raise CommandNotFoundError(
                  'Could not find a `{0}` binary'.format(cmd)
              )
          return which_result
  
      # try to get binary from env
      if os.path.isdir(bin_env):
          cmd_bin = os.path.join(bin_env, 'bin', cmd)
          if os.path.isfile(cmd_bin):
              return cmd_bin
          raise CommandNotFoundError('Could not find a `{0}` binary'.format(cmd))
  
      return bin_env
docs: Return supervisorctl command to call, either from a virtualenv, an argument
      passed in, or from the global modules options