human
Complete the below
def _gen_recurse_managed_files(name, source, keep_symlinks=False, include_pat=None, exclude_pat=None, maxdepth=None, include_empty=False, **kwargs):

    ''''Generate the list of files managed by a recurse state'
    '''
 ... What is a the Python program you requested?
assistant
#Here is the Python program you requested.
    def full_path(master_relpath):
        return os.path.join(name, _salt_to_os_path(master_relpath))
    def process_symlinks(filenames, symlinks):
        for (lname, ltarget) in six.iteritems(symlinks):
            srelpath = posixpath.relpath(lname, srcpath)
            if (not _is_valid_relpath(srelpath, maxdepth=maxdepth)):
                continue
            if (not salt.utils.check_include_exclude(srelpath, include_pat, exclude_pat)):
                continue
            _filenames = list(filenames)
            for filename in _filenames:
                if filename.startswith(lname):
                    log.debug('**    skipping    file    **    {0},    it    intersects    a    symlink'.format(filename))
                    filenames.remove(filename)
            managed_symlinks.add((srelpath, ltarget))
            keep.add(full_path(srelpath))
        vdir.update(keep)
        return filenames
    managed_files = set()
    managed_directories = set()
    managed_symlinks = set()
    keep = set()
    vdir = set()
    (srcpath, senv) = salt.utils.url.parse(source)
    if (senv is None):
        senv = __env__
    if (not srcpath.endswith(posixpath.sep)):
        srcpath = (srcpath + posixpath.sep)
    fns_ = __salt__['cp.list_master'](senv, srcpath)
    if keep_symlinks:
        symlinks = __salt__['cp.list_master_symlinks'](senv, srcpath)
        fns_ = process_symlinks(fns_, symlinks)
    for fn_ in fns_:
        if (not fn_.strip()):
            continue
        relname = sdecode(posixpath.relpath(fn_, srcpath))
        if (not _is_valid_relpath(relname, maxdepth=maxdepth)):
            continue
        if (not salt.utils.check_include_exclude(relname, include_pat, exclude_pat)):
            continue
        dest = full_path(relname)
        dirname = os.path.dirname(dest)
        keep.add(dest)
        if (dirname not in vdir):
            managed_directories.add(dirname)
            vdir.add(dirname)
        src = salt.utils.url.create(fn_, saltenv=senv)
        managed_files.add((dest, src))
 ...