code: def export_ruptures_xml(ekey, dstore):
      
      fmt = ekey[-1]
      oq = dstore['oqparam']
      num_ses = oq.ses_per_logic_tree_path
      mesh = get_mesh(dstore['sitecol'])
      ruptures_by_grp = {}
      for rgetter in gen_rupture_getters(dstore):
          ebrs = [ebr.export(mesh, rgetter.rlzs_by_gsim, num_ses)
                  for ebr in rgetter.get_ruptures()]
          if ebrs:
              ruptures_by_grp[rgetter.grp_id] = ebrs
      dest = dstore.export_path('ses.' + fmt)
      writer = hazard_writers.SESXMLWriter(dest)
      writer.serialize(ruptures_by_grp, oq.investigation_time)
      return [dest]
docs: :param ekey: export key, i.e. a pair (datastore key, fmt)
      :param dstore: datastore object