def find_file(path, search_path):
    """ Find a file by relative path. Arguments:

    path -- the image's filename
    search_path -- a list of directories to check in

    Returns: the resolved file path
    """

    if isinstance(search_path, str):
        search_path = [search_path]
    for relative in search_path:
        candidate = os.path.normpath(os.path.join(relative, path))
        if os.path.isfile(candidate):
            return candidate

    return None
def find_file ( path , search_path ) : if isinstance ( search_path , str ) : search_path = [ search_path ] for relative in search_path : candidate = os . path . normpath ( os . path . join ( relative , path ) ) if os . path . isfile ( candidate ) : return candidate return None
Find a file by relative path. Arguments:

    path -- the image's filename
    search_path -- a list of directories to check in

    Returns: the resolved file path