code: def toxml(self):
          
  
          xmlstr = '<OnCondition test="{0}"'.format(self.test)
  
          chxmlstr = ''
  
          for action in self.actions:
              chxmlstr += action.toxml()
  
          if chxmlstr:
              xmlstr += '>' + chxmlstr + '</OnCondition>'
          else:
              xmlstr += '/>'
  
          return xmlstr
docs: Exports this object into a LEMS XML object