def populate_subtree(basepath, treemap, verbose=False):
file_nodes = OrderedDict()<EOL>if isinstance(treemap, tuple):<EOL><INDENT>try:<EOL><INDENT>file_nodes = process_tuple_node(basepath, treemap)<EOL><DEDENT>except:<EOL><INDENT>raise FileTreeMapError('<STR_LIT>'<EOL>'<STR_LIT>'.format(basepath, treemap))<EOL><DEDENT><DEDENT>if isinstance(treemap, list):<EOL><INDENT>for node in treemap:<EOL><INDENT>try:<EOL><INDENT>file_nodes.update(process_tuple_node(basepath, node))<EOL><DEDENT>except:<EOL><INDENT>raise FileTreeMapError('<STR_LIT>'<EOL>'<STR_LIT>'.format(basepath, node))<EOL><DEDENT><DEDENT><DEDENT>elif isinstance(treemap, dict):<EOL><INDENT>for k in treemap.keys():<EOL><INDENT>cname = k<EOL>child_map = treemap[k]<EOL>if isinstance(child_map, tuple) or isinstance(child_map, dict):<EOL><INDENT>try:<EOL><INDENT>file_nodes[cname] = populate_subtree(basepath, child_map)<EOL><DEDENT>except:<EOL><INDENT>raise FileTreeMapError('<STR_LIT>'<EOL>'<STR_LIT>'.format(basepath,<EOL>child_map))<EOL><DEDENT><DEDENT>elif isinstance(child_map, str):<EOL><INDENT>if child_map[<NUM_LIT:0>] == os.sep:<EOL><INDENT>raise FileTreeMapError('<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'.format(str(child_map),<EOL>os.sep))<EOL><DEDENT>subpaths = get_possible_paths(basepath, child_map)<EOL>if subpaths:<EOL><INDENT>file_nodes[cname] = subpaths<EOL><DEDENT><DEDENT><DEDENT><DEDENT>if verbose:<EOL><INDENT>log.info('<STR_LIT>'.format(basepath, file_nodes.keys()))<EOL><DEDENT>return file_nodes<EOL>
:param path: str

:param treemap: dict

:return: dict