code: def _FindExecutableOnPath(executable, path, pathext):
      """Internal function to a find an executable.
  
      Args:
        executable: The name of the executable to find.
        path: A list of directories to search separated by 'os.pathsep'.
        pathext: An iterable of file name extensions to use.
  
      Returns:
        str, the path to a file on `path` with name `executable` + `p` for
          `p` in `pathext`.
  
      Raises:
        ValueError: invalid input.
      """
  
      if isinstance(pathext, six.string_types):
          raise ValueError(
              "_FindExecutableOnPath(..., pathext='{0}') failed "
              "because pathext must be an iterable of strings, but got "
              "a string.".format(pathext)
          )
  
      # Prioritize preferred extension over earlier in path.
      for ext in pathext:
          for directory in path.split(os.pathsep):
              # Windows can have paths quoted.
              directory = directory.strip('"')
              full = os.path.normpath(
                  os.path.join(directory, executable) + ext
              )
              # On Windows os.access(full, os.X_OK) is always True.
              if os.path.isfile(full) and os.access(full, os.X_OK):
                  return full
      return None
  
file_path: python-fire/fire/console/files.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import unicode_literals
  import os
  from fire.console import encoding
  from fire.console import platforms
  import six
label_desc: Use image node_id 2 for calling a global function with example usage: _FindExecutableOnPath(executable, path, pathext) and returns: None, full