def METHOD_NAME(self):
    """
    run one iteration of a simple decision engine
    """
    # Poll for a decision task.
    tries = 0
    while True:
        dtask = self.conn.poll_for_decision_task(self._domain,
            self._task_list, reverse_order=True)
        if dtask.get('taskToken') is not None:
            # This means a real decision task has arrived.
            break
        time.sleep(2)
        tries += 1
        if tries > 10:
            # Give up if it's taking too long.  Probably
            # means something is broken somewhere else.
            assert False, 'no decision task occurred'
    # Get the most recent interesting event.
    ignorable = (
        'DecisionTaskScheduled',
        'DecisionTaskStarted',
        'DecisionTaskTimedOut',
    )
    event = None
    for tevent in dtask['events']:
        if tevent['eventType'] not in ignorable:
            event = tevent
            break
    # Construct the decision response.
    decisions = Layer1Decisions()
    if event['eventType'] == 'WorkflowExecutionStarted':
        activity_id = str(uuid.uuid1())
        decisions.schedule_activity_task(activity_id,
            self._activity_type_name, self._activity_type_version,
            task_list=self._task_list,
            input=event['workflowExecutionStartedEventAttributes']['input'])
    elif event['eventType'] == 'ActivityTaskCompleted':
        decisions.complete_workflow_execution(
            result=event['activityTaskCompletedEventAttributes']['result'])
    elif event['eventType'] == 'ActivityTaskFailed':
        decisions.fail_workflow_execution(
            reason=event['activityTaskFailedEventAttributes']['reason'],
            details=event['activityTaskFailedEventAttributes']['details'])
    else:
        decisions.fail_workflow_execution(
            reason='unhandled decision task type; %r' % (event['eventType'],))
    # Send the decision response.
    r = self.conn.respond_decision_task_completed(dtask['taskToken'],
                                                  decisions=decisions._data,
                                                  execution_context=None)
    assert r is None