Return an iterator which yields the same values as glob() without actually
    storing them all simultaneously.

    Parameters
    ----------
    pathname : string
        A glob pattern string which will be used for finding files

    Returns
    -------
    iterator
        An iterator instance which will yield full path name

def iglob(pathname):
    """
    Return an iterator which yields the same values as glob() without actually
    storing them all simultaneously.

    Parameters
    ----------
    pathname : string
        A glob pattern string which will be used for finding files

    Returns
    -------
    iterator
        An iterator instance which will yield full path name

    """
    dirname = os.path.dirname(pathname)
    basename_pattern = os.path.basename(pathname)
    for root, dirs, files in os.walk(dirname):
        for basename in files:
            if fnmatch.fnmatch(basename, basename_pattern):
                yield os.path.join(root, basename)