code: def dump_model(self, fout, fmap='', with_stats=False):
          
          if isinstance(fout, STRING_TYPES):
              fout = open(fout, 'w')
              need_close = True
          else:
              need_close = False
          ret = self.get_dump(fmap, with_stats)
          for i in range(len(ret)):
              fout.write('booster[{}]:\n'.format(i))
              fout.write(ret[i])
          if need_close:
              fout.close()
docs: Dump model into a text file.
  
          Parameters
          ----------
          foout : string
              Output file name.
          fmap : string, optional
              Name of the file containing feature map names.
          with_stats : bool (optional)
              Controls whether the split statistics are output.