code: def load_friend_chains(chain, friend_chains, txt, nfiles=None):
      
  
      if re.search('.root?', txt) is not None:
          c = ROOT.TChain(chain.GetName())
          c.SetDirectory(0)
          c.Add(txt)
          friend_chains.append(c)
          chain.AddFriend(c, rand_str())
          return
  
      files = np.loadtxt(txt, unpack=True, dtype='str')
      if files.ndim == 0:
          files = np.array([files])
      if nfiles is not None:
          files = files[:nfiles]
      print("Loading %i files..." % len(files))
  
      c = ROOT.TChain(chain.GetName())
      c.SetDirectory(0)
      for f in files:
          c.Add(f)
      friend_chains.append(c)
  
      chain.AddFriend(c, rand_str())
      return
docs: Load a list of trees from a file and add them as friends to the
      chain.