def find_exe(name, filepath=None):
if filepath:<EOL><INDENT>if not os.path.exists(filepath):<EOL><INDENT>open(filepath)  <EOL><DEDENT>elif not os.path.isfile(filepath):<EOL><INDENT>raise RezBindError("<STR_LIT>" % filepath)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>filepath = which(name)<EOL>if not filepath:<EOL><INDENT>raise RezBindError("<STR_LIT>" % name)<EOL><DEDENT><DEDENT>return filepath<EOL>
Find an executable.

    Args:
        name: Name of the program, eg 'python'.
        filepath: Path to executable, a search is performed if None.

    Returns:
        Path to the executable if found, otherwise an error is raised.