def _get_local_files(local_dir, pattern=''):
    """
    Returns a dictionary with directories as keys, and filenames as values
    for filenames matching the glob ``pattern`` under the ``local_dir``
    ``pattern can contain the Boolean OR | to evaluated multiple patterns into
    a combined set. 
    """
    local_files = {}
    
    if pattern:
        cwd = os.getcwd()
        os.chdir(local_dir)
        patterns = pattern.split('|')
        local_list = set([])
        for p in patterns: local_list = local_list | set(glob(p))
        for path in local_list:
            dir, file = os.path.split(path)
            if os.path.isfile(path):
                local_files[dir] = local_files.get(dir,[])+[file]
            elif os.path.isdir(path):
                local_files[file] = local_files.get(dir,[])
        os.chdir(cwd)
    return local_files
Returns a dictionary with directories as keys, and filenames as values
    for filenames matching the glob ``pattern`` under the ``local_dir``
    ``pattern can contain the Boolean OR | to evaluated multiple patterns into
    a combined set.