def poll_for_decision_task(domain=None, taskList=None, identity=None,
    nextPageToken=None, maximumPageSize=None, reverseOrder=None):
    """
    Used by deciders to get a  DecisionTask from the specified decision taskList . A decision task may be returned for any open workflow execution that is using the specified task list. The task includes a paginated view of the history of the workflow execution. The decider should use the workflow type and the history to determine how to properly handle the task.
    This action initiates a long poll, where the service holds the HTTP connection open and responds as soon a task becomes available. If no decision task is available in the specified task list before the timeout of 60 seconds expires, an empty result is returned. An empty result, in this context, means that a DecisionTask is returned, but that the value of taskToken is an empty string.
    Access Control
    You can use IAM policies to control this action's access to Amazon SWF resources as follows:
    If the caller does not have sufficient permissions to invoke the action, or the parameter values fall outside the specified constraints, the action fails. The associated event attribute's cause parameter will be set to OPERATION_NOT_PERMITTED. For details and example IAM policies, see Using IAM to Manage Access to Amazon SWF Workflows .
    See also: AWS API Documentation
    
    
    :example: response = client.poll_for_decision_task(
        domain='string',
        taskList={
            'name': 'string'
        },
        identity='string',
        nextPageToken='string',
        maximumPageSize=123,
        reverseOrder=True|False
    )
    
    
    :type domain: string
    :param domain: [REQUIRED]
            The name of the domain containing the task lists to poll.
            

    :type taskList: dict
    :param taskList: [REQUIRED]
            Specifies the task list to poll for decision tasks.
            The specified string must not start or end with whitespace. It must not contain a : (colon), / (slash), | (vertical bar), or any control characters (u0000-u001f | u007f - u009f). Also, it must not contain the literal string quotarnquot.
            name (string) -- [REQUIRED]The name of the task list.
            

    :type identity: string
    :param identity: Identity of the decider making the request, which is recorded in the DecisionTaskStarted event in the workflow history. This enables diagnostic tracing when problems arise. The form of this identity is user defined.

    :type nextPageToken: string
    :param nextPageToken: If a NextPageToken was returned by a previous call, there are more results available. To retrieve the next page of results, make the call again using the returned token in nextPageToken . Keep all other arguments unchanged.
            The configured maximumPageSize determines how many results can be returned in a single call.
            Note
            The nextPageToken returned by this action cannot be used with GetWorkflowExecutionHistory to get the next page. You must call PollForDecisionTask again (with the nextPageToken ) to retrieve the next page of history records. Calling PollForDecisionTask with a nextPageToken will not return a new decision task.
            .
            

    :type maximumPageSize: integer
    :param maximumPageSize: The maximum number of results that will be returned per call. nextPageToken can be used to obtain futher pages of results. The default is 1000, which is the maximum allowed page size. You can, however, specify a page size smaller than the maximum.
            This is an upper limit only; the actual number of results returned per call may be fewer than the specified maximum.
            

    :type reverseOrder: boolean
    :param reverseOrder: When set to true , returns the events in reverse order. By default the results are returned in ascending order of the eventTimestamp of the events.

    :rtype: dict
    :return: {
        'taskToken': 'string',
        'startedEventId': 123,
        'workflowExecution': {
            'workflowId': 'string',
            'runId': 'string'
        },
        'workflowType': {
            'name': 'string',
            'version': 'string'
        },
        'events': [
            {
                'eventTimestamp': datetime(2015, 1, 1),
                'eventType': 'WorkflowExecutionStarted'|'WorkflowExecutionCancelRequested'|'WorkflowExecutionCompleted'|'CompleteWorkflowExecutionFailed'|'WorkflowExecutionFailed'|'FailWorkflowExecutionFailed'|'WorkflowExecutionTimedOut'|'WorkflowExecutionCanceled'|'CancelWorkflowExecutionFailed'|'WorkflowExecutionContinuedAsNew'|'ContinueAsNewWorkflowExecutionFailed'|'WorkflowExecutionTerminated'|'DecisionTaskScheduled'|'DecisionTaskStarted'|'DecisionTaskCompleted'|'DecisionTaskTimedOut'|'ActivityTaskScheduled'|'ScheduleActivityTaskFailed'|'ActivityTaskStarted'|'ActivityTaskCompleted'|'ActivityTaskFailed'|'ActivityTaskTimedOut'|'ActivityTaskCanceled'|'ActivityTaskCancelRequested'|'RequestCancelActivityTaskFailed'|'WorkflowExecutionSignaled'|'MarkerRecorded'|'RecordMarkerFailed'|'TimerStarted'|'StartTimerFailed'|'TimerFired'|'TimerCanceled'|'CancelTimerFailed'|'StartChildWorkflowExecutionInitiated'|'StartChildWorkflowExecutionFailed'|'ChildWorkflowExecutionStarted'|'ChildWorkflowExecutionCompleted'|'ChildWorkflowExecutionFailed'|'ChildWorkflowExecutionTimedOut'|'ChildWorkflowExecutionCanceled'|'ChildWorkflowExecutionTerminated'|'SignalExternalWorkflowExecutionInitiated'|'SignalExternalWorkflowExecutionFailed'|'ExternalWorkflowExecutionSignaled'|'RequestCancelExternalWorkflowExecutionInitiated'|'RequestCancelExternalWorkflowExecutionFailed'|'ExternalWorkflowExecutionCancelRequested'|'LambdaFunctionScheduled'|'LambdaFunctionStarted'|'LambdaFunctionCompleted'|'LambdaFunctionFailed'|'LambdaFunctionTimedOut'|'ScheduleLambdaFunctionFailed'|'StartLambdaFunctionFailed',
                'eventId': 123,
                'workflowExecutionStartedEventAttributes': {
                    'input': 'string',
                    'executionStartToCloseTimeout': 'string',
                    'taskStartToCloseTimeout': 'string',
                    'childPolicy': 'TERMINATE'|'REQUEST_CANCEL'|'ABANDON',
                    'taskList': {
                        'name': 'string'
                    },
                    'workflowType': {
                        'name': 'string',
                        'version': 'string'
                    },
                    'tagList': [
                        'string',
                    ],
                    'taskPriority': 'string',
                    'continuedExecutionRunId': 'string',
                    'parentWorkflowExecution': {
                        'workflowId': 'string',
                        'runId': 'string'
                    },
                    'parentInitiatedEventId': 123,
                    'lambdaRole': 'string'
                },
                'workflowExecutionCompletedEventAttributes': {
                    'result': 'string',
                    'decisionTaskCompletedEventId': 123
                },
                'completeWorkflowExecutionFailedEventAttributes': {
                    'cause': 'UNHANDLED_DECISION'|'OPERATION_NOT_PERMITTED',
                    'decisionTaskCompletedEventId': 123
                },
                'workflowExecutionFailedEventAttributes': {
                    'reason': 'string',
                    'details': 'string',
                    'decisionTaskCompletedEventId': 123
                },
                'failWorkflowExecutionFailedEventAttributes': {
                    'cause': 'UNHANDLED_DECISION'|'OPERATION_NOT_PERMITTED',
                    'decisionTaskCompletedEventId': 123
                },
                'workflowExecutionTimedOutEventAttributes': {
                    'timeoutType': 'START_TO_CLOSE',
                    'childPolicy': 'TERMINATE'|'REQUEST_CANCEL'|'ABANDON'
                },
                'workflowExecutionCanceledEventAttributes': {
                    'details': 'string',
                    'decisionTaskCompletedEventId': 123
                },
                'cancelWorkflowExecutionFailedEventAttributes': {
                    'cause': 'UNHANDLED_DECISION'|'OPERATION_NOT_PERMITTED',
                    'decisionTaskCompletedEventId': 123
                },
                'workflowExecutionContinuedAsNewEventAttributes': {
                    'input': 'string',
                    'decisionTaskCompletedEventId': 123,
                    'newExecutionRunId': 'string',
                    'executionStartToCloseTimeout': 'string',
                    'taskList': {
                        'name': 'string'
                    },
                    'taskPriority': 'string',
                    'taskStartToCloseTimeout': 'string',
                    'childPolicy': 'TERMINATE'|'REQUEST_CANCEL'|'ABANDON',
                    'tagList': [
                        'string',
                    ],
                    'workflowType': {
                        'name': 'string',
                        'version': 'string'
                    },
                    'lambdaRole': 'string'
                },
                'continueAsNewWorkflowExecutionFailedEventAttributes': {
                    'cause': 'UNHANDLED_DECISION'|'WORKFLOW_TYPE_DEPRECATED'|'WORKFLOW_TYPE_DOES_NOT_EXIST'|'DEFAULT_EXECUTION_START_TO_CLOSE_TIMEOUT_UNDEFINED'|'DEFAULT_TASK_START_TO_CLOSE_TIMEOUT_UNDEFINED'|'DEFAULT_TASK_LIST_UNDEFINED'|'DEFAULT_CHILD_POLICY_UNDEFINED'|'CONTINUE_AS_NEW_WORKFLOW_EXECUTION_RATE_EXCEEDED'|'OPERATION_NOT_PERMITTED',
                    'decisionTaskCompletedEventId': 123
                },
                'workflowExecutionTerminatedEventAttributes': {
                    'reason': 'string',
                    'details': 'string',
                    'childPolicy': 'TERMINATE'|'REQUEST_CANCEL'|'ABANDON',
                    'cause': 'CHILD_POLICY_APPLIED'|'EVENT_LIMIT_EXCEEDED'|'OPERATOR_INITIATED'
                },
                'workflowExecutionCancelRequestedEventAttributes': {
                    'externalWorkflowExecution': {
                        'workflowId': 'string',
                        'runId': 'string'
                    },
                    'externalInitiatedEventId': 123,
                    'cause': 'CHILD_POLICY_APPLIED'
                },
                'decisionTaskScheduledEventAttributes': {
                    'taskList': {
                        'name': 'string'
                    },
                    'taskPriority': 'string',
                    'startToCloseTimeout': 'string'
                },
                'decisionTaskStartedEventAttributes': {
                    'identity': 'string',
                    'scheduledEventId': 123
                },
                'decisionTaskCompletedEventAttributes': {
                    'executionContext': 'string',
                    'scheduledEventId': 123,
                    'startedEventId': 123
                },
                'decisionTaskTimedOutEventAttributes': {
                    'timeoutType': 'START_TO_CLOSE',
                    'scheduledEventId': 123,
                    'startedEventId': 123
                },
                'activityTaskScheduledEventAttributes': {
                    'activityType': {
                        'name': 'string',
                        'version': 'string'
                    },
                    'activityId': 'string',
                    'input': 'string',
                    'control': 'string',
                    'scheduleToStartTimeout': 'string',
                    'scheduleToCloseTimeout': 'string',
                    'startToCloseTimeout': 'string',
                    'taskList': {
                        'name': 'string'
                    },
                    'taskPriority': 'string',
                    'decisionTaskCompletedEventId': 123,
                    'heartbeatTimeout': 'string'
                },
                'activityTaskStartedEventAttributes': {
                    'identity': 'string',
                    'scheduledEventId': 123
                },
                'activityTaskCompletedEventAttributes': {
                    'result': 'string',
                    'scheduledEventId': 123,
                    'startedEventId': 123
                },
                'activityTaskFailedEventAttributes': {
                    'reason': 'string',
                    'details': 'string',
                    'scheduledEventId': 123,
                    'startedEventId': 123
                },
                'activityTaskTimedOutEventAttributes': {
                    'timeoutType': 'START_TO_CLOSE'|'SCHEDULE_TO_START'|'SCHEDULE_TO_CLOSE'|'HEARTBEAT',
                    'scheduledEventId': 123,
                    'startedEventId': 123,
                    'details': 'string'
                },
                'activityTaskCanceledEventAttributes': {
                    'details': 'string',
                    'scheduledEventId': 123,
                    'startedEventId': 123,
                    'latestCancelRequestedEventId': 123
                },
                'activityTaskCancelRequestedEventAttributes': {
                    'decisionTaskCompletedEventId': 123,
                    'activityId': 'string'
                },
                'workflowExecutionSignaledEventAttributes': {
                    'signalName': 'string',
                    'input': 'string',
                    'externalWorkflowExecution': {
                        'workflowId': 'string',
                        'runId': 'string'
                    },
                    'externalInitiatedEventId': 123
                },
                'markerRecordedEventAttributes': {
                    'markerName': 'string',
                    'details': 'string',
                    'decisionTaskCompletedEventId': 123
                },
                'recordMarkerFailedEventAttributes': {
                    'markerName': 'string',
                    'cause': 'OPERATION_NOT_PERMITTED',
                    'decisionTaskCompletedEventId': 123
                },
                'timerStartedEventAttributes': {
                    'timerId': 'string',
                    'control': 'string',
                    'startToFireTimeout': 'string',
                    'decisionTaskCompletedEventId': 123
                },
                'timerFiredEventAttributes': {
                    'timerId': 'string',
                    'startedEventId': 123
                },
                'timerCanceledEventAttributes': {
                    'timerId': 'string',
                    'startedEventId': 123,
                    'decisionTaskCompletedEventId': 123
                },
                'startChildWorkflowExecutionInitiatedEventAttributes': {
                    'workflowId': 'string',
                    'workflowType': {
                        'name': 'string',
                        'version': 'string'
                    },
                    'control': 'string',
                    'input': 'string',
                    'executionStartToCloseTimeout': 'string',
                    'taskList': {
                        'name': 'string'
                    },
                    'taskPriority': 'string',
                    'decisionTaskCompletedEventId': 123,
                    'childPolicy': 'TERMINATE'|'REQUEST_CANCEL'|'ABANDON',
                    'taskStartToCloseTimeout': 'string',
                    'tagList': [
                        'string',
                    ],
                    'lambdaRole': 'string'
                },
                'childWorkflowExecutionStartedEventAttributes': {
                    'workflowExecution': {
                        'workflowId': 'string',
                        'runId': 'string'
                    },
                    'workflowType': {
                        'name': 'string',
                        'version': 'string'
                    },
                    'initiatedEventId': 123
                },
                'childWorkflowExecutionCompletedEventAttributes': {
                    'workflowExecution': {
                        'workflowId': 'string',
                        'runId': 'string'
                    },
                    'workflowType': {
                        'name': 'string',
                        'version': 'string'
                    },
                    'result': 'string',
                    'initiatedEventId': 123,
                    'startedEventId': 123
                },
                'childWorkflowExecutionFailedEventAttributes': {
                    'workflowExecution': {
                        'workflowId': 'string',
                        'runId': 'string'
                    },
                    'workflowType': {
                        'name': 'string',
                        'version': 'string'
                    },
                    'reason': 'string',
                    'details': 'string',
                    'initiatedEventId': 123,
                    'startedEventId': 123
                },
                'childWorkflowExecutionTimedOutEventAttributes': {
                    'workflowExecution': {
                        'workflowId': 'string',
                        'runId': 'string'
                    },
                    'workflowType': {
                        'name': 'string',
                        'version': 'string'
                    },
                    'timeoutType': 'START_TO_CLOSE',
                    'initiatedEventId': 123,
                    'startedEventId': 123
                },
                'childWorkflowExecutionCanceledEventAttributes': {
                    'workflowExecution': {
                        'workflowId': 'string',
                        'runId': 'string'
                    },
                    'workflowType': {
                        'name': 'string',
                        'version': 'string'
                    },
                    'details': 'string',
                    'initiatedEventId': 123,
                    'startedEventId': 123
                },
                'childWorkflowExecutionTerminatedEventAttributes': {
                    'workflowExecution': {
                        'workflowId': 'string',
                        'runId': 'string'
                    },
                    'workflowType': {
                        'name': 'string',
                        'version': 'string'
                    },
                    'initiatedEventId': 123,
                    'startedEventId': 123
                },
                'signalExternalWorkflowExecutionInitiatedEventAttributes': {
                    'workflowId': 'string',
                    'runId': 'string',
                    'signalName': 'string',
                    'input': 'string',
                    'decisionTaskCompletedEventId': 123,
                    'control': 'string'
                },
                'externalWorkflowExecutionSignaledEventAttributes': {
                    'workflowExecution': {
                        'workflowId': 'string',
                        'runId': 'string'
                    },
                    'initiatedEventId': 123
                },
                'signalExternalWorkflowExecutionFailedEventAttributes': {
                    'workflowId': 'string',
                    'runId': 'string',
                    'cause': 'UNKNOWN_EXTERNAL_WORKFLOW_EXECUTION'|'SIGNAL_EXTERNAL_WORKFLOW_EXECUTION_RATE_EXCEEDED'|'OPERATION_NOT_PERMITTED',
                    'initiatedEventId': 123,
                    'decisionTaskCompletedEventId': 123,
                    'control': 'string'
                },
                'externalWorkflowExecutionCancelRequestedEventAttributes': {
                    'workflowExecution': {
                        'workflowId': 'string',
                        'runId': 'string'
                    },
                    'initiatedEventId': 123
                },
                'requestCancelExternalWorkflowExecutionInitiatedEventAttributes': {
                    'workflowId': 'string',
                    'runId': 'string',
                    'decisionTaskCompletedEventId': 123,
                    'control': 'string'
                },
                'requestCancelExternalWorkflowExecutionFailedEventAttributes': {
                    'workflowId': 'string',
                    'runId': 'string',
                    'cause': 'UNKNOWN_EXTERNAL_WORKFLOW_EXECUTION'|'REQUEST_CANCEL_EXTERNAL_WORKFLOW_EXECUTION_RATE_EXCEEDED'|'OPERATION_NOT_PERMITTED',
                    'initiatedEventId': 123,
                    'decisionTaskCompletedEventId': 123,
                    'control': 'string'
                },
                'scheduleActivityTaskFailedEventAttributes': {
                    'activityType': {
                        'name': 'string',
                        'version': 'string'
                    },
                    'activityId': 'string',
                    'cause': 'ACTIVITY_TYPE_DEPRECATED'|'ACTIVITY_TYPE_DOES_NOT_EXIST'|'ACTIVITY_ID_ALREADY_IN_USE'|'OPEN_ACTIVITIES_LIMIT_EXCEEDED'|'ACTIVITY_CREATION_RATE_EXCEEDED'|'DEFAULT_SCHEDULE_TO_CLOSE_TIMEOUT_UNDEFINED'|'DEFAULT_TASK_LIST_UNDEFINED'|'DEFAULT_SCHEDULE_TO_START_TIMEOUT_UNDEFINED'|'DEFAULT_START_TO_CLOSE_TIMEOUT_UNDEFINED'|'DEFAULT_HEARTBEAT_TIMEOUT_UNDEFINED'|'OPERATION_NOT_PERMITTED',
                    'decisionTaskCompletedEventId': 123
                },
                'requestCancelActivityTaskFailedEventAttributes': {
                    'activityId': 'string',
                    'cause': 'ACTIVITY_ID_UNKNOWN'|'OPERATION_NOT_PERMITTED',
                    'decisionTaskCompletedEventId': 123
                },
                'startTimerFailedEventAttributes': {
                    'timerId': 'string',
                    'cause': 'TIMER_ID_ALREADY_IN_USE'|'OPEN_TIMERS_LIMIT_EXCEEDED'|'TIMER_CREATION_RATE_EXCEEDED'|'OPERATION_NOT_PERMITTED',
                    'decisionTaskCompletedEventId': 123
                },
                'cancelTimerFailedEventAttributes': {
                    'timerId': 'string',
                    'cause': 'TIMER_ID_UNKNOWN'|'OPERATION_NOT_PERMITTED',
                    'decisionTaskCompletedEventId': 123
                },
                'startChildWorkflowExecutionFailedEventAttributes': {
                    'workflowType': {
                        'name': 'string',
                        'version': 'string'
                    },
                    'cause': 'WORKFLOW_TYPE_DOES_NOT_EXIST'|'WORKFLOW_TYPE_DEPRECATED'|'OPEN_CHILDREN_LIMIT_EXCEEDED'|'OPEN_WORKFLOWS_LIMIT_EXCEEDED'|'CHILD_CREATION_RATE_EXCEEDED'|'WORKFLOW_ALREADY_RUNNING'|'DEFAULT_EXECUTION_START_TO_CLOSE_TIMEOUT_UNDEFINED'|'DEFAULT_TASK_LIST_UNDEFINED'|'DEFAULT_TASK_START_TO_CLOSE_TIMEOUT_UNDEFINED'|'DEFAULT_CHILD_POLICY_UNDEFINED'|'OPERATION_NOT_PERMITTED',
                    'workflowId': 'string',
                    'initiatedEventId': 123,
                    'decisionTaskCompletedEventId': 123,
                    'control': 'string'
                },
                'lambdaFunctionScheduledEventAttributes': {
                    'id': 'string',
                    'name': 'string',
                    'input': 'string',
                    'startToCloseTimeout': 'string',
                    'decisionTaskCompletedEventId': 123
                },
                'lambdaFunctionStartedEventAttributes': {
                    'scheduledEventId': 123
                },
                'lambdaFunctionCompletedEventAttributes': {
                    'scheduledEventId': 123,
                    'startedEventId': 123,
                    'result': 'string'
                },
                'lambdaFunctionFailedEventAttributes': {
                    'scheduledEventId': 123,
                    'startedEventId': 123,
                    'reason': 'string',
                    'details': 'string'
                },
                'lambdaFunctionTimedOutEventAttributes': {
                    'scheduledEventId': 123,
                    'startedEventId': 123,
                    'timeoutType': 'START_TO_CLOSE'
                },
                'scheduleLambdaFunctionFailedEventAttributes': {
                    'id': 'string',
                    'name': 'string',
                    'cause': 'ID_ALREADY_IN_USE'|'OPEN_LAMBDA_FUNCTIONS_LIMIT_EXCEEDED'|'LAMBDA_FUNCTION_CREATION_RATE_EXCEEDED'|'LAMBDA_SERVICE_NOT_AVAILABLE_IN_REGION',
                    'decisionTaskCompletedEventId': 123
                },
                'startLambdaFunctionFailedEventAttributes': {
                    'scheduledEventId': 123,
                    'cause': 'ASSUME_ROLE_FAILED',
                    'message': 'string'
                }
            },
        ],
        'nextPageToken': 'string',
        'previousStartedEventId': 123
    }
    
    
    :returns: 
    domain (string) -- [REQUIRED]
    The name of the domain containing the task lists to poll.
    
    taskList (dict) -- [REQUIRED]
    Specifies the task list to poll for decision tasks.
    The specified string must not start or end with whitespace. It must not contain a : (colon), / (slash), | (vertical bar), or any control characters (u0000-u001f | u007f - u009f). Also, it must not contain the literal string quotarnquot.
    
    name (string) -- [REQUIRED]The name of the task list.
    
    
    
    identity (string) -- Identity of the decider making the request, which is recorded in the DecisionTaskStarted event in the workflow history. This enables diagnostic tracing when problems arise. The form of this identity is user defined.
    nextPageToken (string) -- If a NextPageToken was returned by a previous call, there are more results available. To retrieve the next page of results, make the call again using the returned token in nextPageToken . Keep all other arguments unchanged.
    The configured maximumPageSize determines how many results can be returned in a single call.
    
    Note
    The nextPageToken returned by this action cannot be used with  GetWorkflowExecutionHistory to get the next page. You must call  PollForDecisionTask again (with the nextPageToken ) to retrieve the next page of history records. Calling  PollForDecisionTask with a nextPageToken will not return a new decision task.
    
    .
    
    maximumPageSize (integer) -- The maximum number of results that will be returned per call. nextPageToken can be used to obtain futher pages of results. The default is 1000, which is the maximum allowed page size. You can, however, specify a page size smaller than the maximum.
    This is an upper limit only; the actual number of results returned per call may be fewer than the specified maximum.
    
    reverseOrder (boolean) -- When set to true , returns the events in reverse order. By default the results are returned in ascending order of the eventTimestamp of the events.
    
    """
    pass
