code: def write(filename, samples, write_params=None, static_args=None):
          
          xmldoc = ligolw.Document()
          xmldoc.appendChild(ligolw.LIGO_LW())
          simtable = lsctables.New(lsctables.SimInspiralTable)
          xmldoc.childNodes[0].appendChild(simtable)
          if static_args is None:
              static_args = {}
          if write_params is None:
              write_params = samples.fieldnames
          for ii in range(samples.size):
              sim = lsctables.SimInspiral()
              # initialize all elements to None
              for col in sim.__slots__:
                  setattr(sim, col, None)
              for field in write_params:
                  data = samples[ii][field]
                  set_sim_data(sim, field, data)
              # set any static args
              for (field, value) in static_args.items():
                  set_sim_data(sim, field, value)
              simtable.append(sim)
          ligolw_utils.write_filename(xmldoc, filename,
                                      gz=filename.endswith('gz'))
docs: Writes the injection samples to the given xml.
  
          Parameters
          ----------
          filename : str
              The name of the file to write to.
          samples : io.FieldArray
              FieldArray of parameters.
          write_params : list, optional
              Only write the given parameter names. All given names must be keys
              in ``samples``. Default is to write all parameters in ``samples``.
          static_args : dict, optional
              Dictionary mapping static parameter names to values. These are
              written to the ``attrs``.