def find_tool(name, additional_paths = [], path_last = False):
    """ Attempts to find tool (binary) named 'name' in PATH and in
        'additional-paths'.  If found in path, returns 'name'.  If
        found in additional paths, returns full name.  If the tool
        is found in several directories, returns the first path found.
        Otherwise, returns the empty string.  If 'path_last' is specified,
        path is checked after 'additional_paths'.
    """
    assert isinstance(name, basestring)
    assert is_iterable_typed(additional_paths, basestring)
    assert isinstance(path_last, (int, bool))

    programs = path.programs_path()
    match = path.glob(programs, [name, name + '.exe'])
    additional_match = path.glob(additional_paths, [name, name + '.exe'])

    result = []
    if path_last:
        result = additional_match
        if not result and match:
            result = match

    else:
        if match:
            result = match

        elif additional_match:
            result = additional_match

    if result:
        return path.native(result[0])
    else:
        return ''
def find_tool ( name , additional_paths = [ ] , path_last = False ) : assert isinstance ( name , basestring ) assert is_iterable_typed ( additional_paths , basestring ) assert isinstance ( path_last , ( int , bool ) ) programs = path . programs_path ( ) match = path . glob ( programs , [ name , name + '.exe' ] ) additional_match = path . glob ( additional_paths , [ name , name + '.exe' ] ) result = [ ] if path_last : result = additional_match if not result and match : result = match else : if match : result = match elif additional_match : result = additional_match if result : return path . native ( result [ 0 ] ) else : return ''
Attempts to find tool (binary) named 'name' in PATH and in
        'additional-paths'.  If found in path, returns 'name'.  If
        found in additional paths, returns full name.  If the tool
        is found in several directories, returns the first path found.
        Otherwise, returns the empty string.  If 'path_last' is specified,
        path is checked after 'additional_paths'.