def _do_get_file_map(file_tree):
 file_map = []
 stack = [file_tree]
 while len(stack):
  tree_node = stack.pop(0)
  if (tree_node['kind'] == 'file'):
   file_map.append((tree_node['extra']['hashes']['sha256'], tree_node))
  else:
   stack = (stack + tree_node['children'])
 return file_map

def _do_get_file_map ( file_tree ) : file_map = [ ] stack = [ file_tree ] while len ( stack ) : tree_node = stack . pop ( 0 ) if ( tree_node [ 'kind' ] == 'file' ) : file_map . append ( ( tree_node [ 'extra' ] [ 'hashes' ] [ 'sha256' ] , tree_node ) ) else : stack = ( stack + tree_node [ 'children' ] ) return file_map
reduces a tree of folders and files into a list of pairs .