def METHOD_NAME(dir,label,it1="",itN=""):
  """it1 and itN   are the first and the last iterations' directory names
     dir           is some directory with the results from for the LAST 
                   iteration, so it must contain a itN substring 
     label         is a label for tree's folder for this directory"""
  if len(itN)>0 and dir.find(itN)==-1:
    print("directory ", dir, "has no ", itN, " in it!!")
    return ["problem!!!",""]
  res = [label,dir]
  files = sorted(os.listdir(dir))
  for f in files:
    if re.match(".+\.png", f):
      if len(it1)>0 and len(itN)>0:
        lnN = [itN,dir+'/'+f]
        dir1 = dir.replace(itN,it1)
        if not os.access(dir1+'/'+f,os.F_OK):
          print("WARNING: no ",dir1+'/'+f," file found!!!")
        ln1 = [it1,dir1+'/'+f]
        ln = [NAME_TO_TITLE[f],dir+'/'+f,ln1,lnN]
        res.append(ln)
      else:
        ln = [NAME_TO_TITLE[f],dir+'/'+f]
        #print ln
        res.append(ln)
  #pp.pprint(res)
  return res