def find_files(directory, pattern):
    """
    Recusively finds files in a directory re
    :param directory: base directory
    :param pattern: wildcard pattern
    :return: generator with filenames matching pattern
    """
    for root, __, files in os.walk(directory):
        for basename in files:
            if fnmatch.fnmatch(basename, pattern):
                filename = os.path.join(root, basename)
                yield filename