Searches for a file and returns its path upon finding it.

    Searches for a file with the given `name` in the list of directories
    mentioned in `path`. It also supports `deep` search (recursive) and
    `partial` search (searching for files having filename matching
    partially with the query) through the respective boolean arguments.

    Parameters
    ----------
    name : str
        The name of the file to search for.
    path : str or list of str, optional
        The list of directories to be searched. It can be either a 
        single str with the directory paths being seperated by
        `os.pathsep`, or a list of the directory path strings. The 
        default is the system `PATH`.
    deep : bool, optional
        Enables deep-searching, i.e. recursively looking for the file 
        in the sub-directories of the mentioned directories.
    partial : bool, optional
        Whether look for files having filename partially matching with 
        the query `name`.

    Returns
    -------
    str
        The path of the file. In case of multiple hits, it only return 
        the first one.

def find_file(name, path=os.getcwd(), deep=False, partial=False):
    """
    Searches for a file and returns its path upon finding it.

    Searches for a file with the given `name` in the list of directories
    mentioned in `path`. It also supports `deep` search (recursive) and
    `partial` search (searching for files having filename matching
    partially with the query) through the respective boolean arguments.

    Parameters
    ----------
    name : str
        The name of the file to search for.
    path : str or list of str, optional
        The list of directories to be searched. It can be either a 
        single str with the directory paths being seperated by
        `os.pathsep`, or a list of the directory path strings. The 
        default is the system `PATH`.
    deep : bool, optional
        Enables deep-searching, i.e. recursively looking for the file 
        in the sub-directories of the mentioned directories.
    partial : bool, optional
        Whether look for files having filename partially matching with 
        the query `name`.

    Returns
    -------
    str
        The path of the file. In case of multiple hits, it only return 
        the first one.
    """

    paths = path.split(os.pathsep) if type(path) is str else path
    for p in paths:
        ret = __find_file(name, p, deep, partial)
        if ret:
            return ret