def get_possible_paths(base_path, path_regex):
if not path_regex:<EOL><INDENT>return []<EOL><DEDENT>if len(path_regex) < <NUM_LIT:1>:<EOL><INDENT>return []<EOL><DEDENT>if path_regex[<NUM_LIT:0>] == os.sep:<EOL><INDENT>path_regex = path_regex[<NUM_LIT:1>:]<EOL><DEDENT>rest_files = '<STR_LIT>'<EOL>if os.sep in path_regex:<EOL><INDENT>node_names = path_regex.partition(os.sep)<EOL>first_node = node_names[<NUM_LIT:0>]<EOL>rest_nodes = node_names[<NUM_LIT:2>]<EOL>folder_names = filter_list(os.listdir(base_path), first_node)<EOL>for nom in folder_names:<EOL><INDENT>new_base = op.join(base_path, nom)<EOL>if op.isdir(new_base):<EOL><INDENT>rest_files = get_possible_paths(new_base, rest_nodes)<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>rest_files = filter_list(os.listdir(base_path), path_regex)<EOL><DEDENT>files = []<EOL>if rest_files:<EOL><INDENT>files = [op.join(base_path, f) for f in rest_files]<EOL><DEDENT>return files<EOL>
Looks for path_regex within base_path. Each match is append
in the returned list.
path_regex may contain subfolder structure.
If any part of the folder structure is a

:param base_path: str

:param path_regex: str

:return list of strings