code: def message_iter(evt):
          
          iter = evt.CreateMessageIterator()
          while iter.Next():
              msg = iter.Message
              if DEBUG:
                  print msg.Print
              if msg.AsElement.HasElement('responseError'):
                  raise Exception(msg.AsElement.GetValue('message'))
              yield msg
docs: provide a message iterator which checks for a response error prior to returning