def rate_limited_scan(self, table_name, filter_condition=None, attributes_to_get=None, page_size=None, limit=None, conditional_operator=None, scan_filter=None, exclusive_start_key=None, segment=None, total_segments=None, timeout_seconds=None, read_capacity_to_consume_per_second=10, allow_rate_limited_scan_without_consumed_capacity=None, max_sleep_between_retry=10, max_consecutive_exceptions=10, consistent_read=None, index_name=None):
    "\n        Performs a rate limited scan on the table. The API uses the scan API to fetch items from\n        DynamoDB. The rate_limited_scan uses the 'ConsumedCapacity' value returned from DynamoDB to\n        limit the rate of the scan. 'ProvisionedThroughputExceededException' is also handled and retried.\n\n        :param table_name: Name of the table to perform scan on.\n        :param filter_condition: Condition used to restrict the scan results\n        :param attributes_to_get: A list of attributes to return.\n        :param page_size: Page size of the scan to DynamoDB\n        :param limit: Used to limit the number of results returned\n        :param conditional_operator:\n        :param scan_filter: A map indicating the condition that evaluates the scan results\n        :param exclusive_start_key: If set, provides the starting point for scan.\n        :param segment: If set, then scans the segment\n        :param total_segments: If set, then specifies total segments\n        :param timeout_seconds: Timeout value for the rate_limited_scan method, to prevent it from running\n            infinitely\n        :param read_capacity_to_consume_per_second: Amount of read capacity to consume\n            every second\n        :param allow_rate_limited_scan_without_consumed_capacity: If set, proceeds without rate limiting if\n            the server does not support returning consumed capacity in responses.\n        :param max_sleep_between_retry: Max value for sleep in seconds in between scans during\n            throttling/rate limit scenarios\n        :param max_consecutive_exceptions: Max number of consecutive ProvisionedThroughputExceededException\n            exception for scan to exit\n        :param consistent_read: enable consistent read\n        :param index_name: an index to perform the scan on\n        "
    read_capacity_to_consume_per_ms = (float(read_capacity_to_consume_per_second) / 1000)
    if (allow_rate_limited_scan_without_consumed_capacity is None):
        allow_rate_limited_scan_without_consumed_capacity = get_settings_value('allow_rate_limited_scan_without_consumed_capacity')
    total_consumed_read_capacity = 0.0
    last_evaluated_key = exclusive_start_key
    rate_available = True
    latest_scan_consumed_capacity = 0
    consecutive_provision_throughput_exceeded_ex = 0
    start_time = time.time()
    if (page_size is None):
        if (limit and (read_capacity_to_consume_per_second > limit)):
            page_size = limit
        else:
            page_size = read_capacity_to_consume_per_second
    while True:
        if rate_available:
            try:
                data = self.scan(table_name, filter_condition=filter_condition, attributes_to_get=attributes_to_get, exclusive_start_key=last_evaluated_key, limit=page_size, conditional_operator=conditional_operator, return_consumed_capacity=TOTAL, scan_filter=scan_filter, segment=segment, total_segments=total_segments, consistent_read=consistent_read, index_name=index_name)
                for item in data.get(ITEMS):
                    (yield item)
                    if (limit is not None):
                        limit -= 1
                        if (not limit):
                            return
                if (CONSUMED_CAPACITY in data):
                    latest_scan_consumed_capacity = data.get(CONSUMED_CAPACITY).get(CAPACITY_UNITS)
                elif allow_rate_limited_scan_without_consumed_capacity:
                    latest_scan_consumed_capacity = 0
                else:
                    raise ScanError('Rate limited scan not possible because the server did not send backconsumed capacity information. If you wish scans to complete anywaywithout functioning rate limiting, set allow_rate_limited_scan_without_consumed_capacity to True in settings.')
                last_evaluated_key = data.get(LAST_EVALUATED_KEY, None)
                consecutive_provision_throughput_exceeded_ex = 0
            except ScanError as e:
                if isinstance(e.cause, ClientError):
                    code = e.cause.response['Error'].get('Code')
                    if (code == 'ProvisionedThroughputExceededException'):
                        consecutive_provision_throughput_exceeded_ex += 1
                        if (consecutive_provision_throughput_exceeded_ex > max_consecutive_exceptions):
                            raise
                    else:
                        raise
                else:
                    raise
        if ((not last_evaluated_key) and (consecutive_provision_throughput_exceeded_ex == 0)):
            return
        current_time = time.time()
        elapsed_time_ms = max(1, round(((current_time - start_time) * 1000)))
        if (consecutive_provision_throughput_exceeded_ex == 0):
            total_consumed_read_capacity += latest_scan_consumed_capacity
            consumed_rate = (total_consumed_read_capacity / elapsed_time_ms)
            rate_available = ((read_capacity_to_consume_per_ms - consumed_rate) >= 0)
        if ((not rate_available) or (consecutive_provision_throughput_exceeded_ex > 0)):
            elapsed_time_s = math.ceil((elapsed_time_ms / 1000))
            time_to_sleep = max(1, round(((total_consumed_read_capacity / elapsed_time_s) / read_capacity_to_consume_per_second)))
            if (timeout_seconds and ((elapsed_time_s + time_to_sleep) > timeout_seconds)):
                raise ScanError('Input timeout value {0} has expired'.format(timeout_seconds))
            time.sleep(min(math.ceil(time_to_sleep), max_sleep_between_retry))
            latest_scan_consumed_capacity = 0
Performs a rate limited scan on the table. The API uses the scan API to fetch items from
DynamoDB. The rate_limited_scan uses the 'ConsumedCapacity' value returned from DynamoDB to
limit the rate of the scan. 'ProvisionedThroughputExceededException' is also handled and retried.

:param table_name: Name of the table to perform scan on.
:param filter_condition: Condition used to restrict the scan results
:param attributes_to_get: A list of attributes to return.
:param page_size: Page size of the scan to DynamoDB
:param limit: Used to limit the number of results returned
:param conditional_operator:
:param scan_filter: A map indicating the condition that evaluates the scan results
:param exclusive_start_key: If set, provides the starting point for scan.
:param segment: If set, then scans the segment
:param total_segments: If set, then specifies total segments
:param timeout_seconds: Timeout value for the rate_limited_scan method, to prevent it from running
    infinitely
:param read_capacity_to_consume_per_second: Amount of read capacity to consume
    every second
:param allow_rate_limited_scan_without_consumed_capacity: If set, proceeds without rate limiting if
    the server does not support returning consumed capacity in responses.
:param max_sleep_between_retry: Max value for sleep in seconds in between scans during
    throttling/rate limit scenarios
:param max_consecutive_exceptions: Max number of consecutive ProvisionedThroughputExceededException
    exception for scan to exit
:param consistent_read: enable consistent read
:param index_name: an index to perform the scan on
def rate_limited_scan(self, table_name, filter_condition=None, attributes_to_get=None, page_size=None, limit=None, conditional_operator=None, scan_filter=None, exclusive_start_key=None, segment=None, total_segments=None, timeout_seconds=None, read_capacity_to_consume_per_second=10, allow_rate_limited_scan_without_consumed_capacity=None, max_sleep_between_retry=10, max_consecutive_exceptions=10, consistent_read=None, index_name=None):
    "\n        Performs a rate limited scan on the table. The API uses the scan API to fetch items from\n        DynamoDB. The rate_limited_scan uses the 'ConsumedCapacity' value returned from DynamoDB to\n        limit the rate of the scan. 'ProvisionedThroughputExceededException' is also handled and retried.\n\n        :param table_name: Name of the table to perform scan on.\n        :param filter_condition: Condition used to restrict the scan results\n        :param attributes_to_get: A list of attributes to return.\n        :param page_size: Page size of the scan to DynamoDB\n        :param limit: Used to limit the number of results returned\n        :param conditional_operator:\n        :param scan_filter: A map indicating the condition that evaluates the scan results\n        :param exclusive_start_key: If set, provides the starting point for scan.\n        :param segment: If set, then scans the segment\n        :param total_segments: If set, then specifies total segments\n        :param timeout_seconds: Timeout value for the rate_limited_scan method, to prevent it from running\n            infinitely\n        :param read_capacity_to_consume_per_second: Amount of read capacity to consume\n            every second\n        :param allow_rate_limited_scan_without_consumed_capacity: If set, proceeds without rate limiting if\n            the server does not support returning consumed capacity in responses.\n        :param max_sleep_between_retry: Max value for sleep in seconds in between scans during\n            throttling/rate limit scenarios\n        :param max_consecutive_exceptions: Max number of consecutive ProvisionedThroughputExceededException\n            exception for scan to exit\n        :param consistent_read: enable consistent read\n        :param index_name: an index to perform the scan on\n        "
    read_capacity_to_consume_per_ms = (float(read_capacity_to_consume_per_second) / 1000)
    if (allow_rate_limited_scan_without_consumed_capacity is None):
        allow_rate_limited_scan_without_consumed_capacity = get_settings_value('allow_rate_limited_scan_without_consumed_capacity')
    total_consumed_read_capacity = 0.0
    last_evaluated_key = exclusive_start_key
    rate_available = True
    latest_scan_consumed_capacity = 0
    consecutive_provision_throughput_exceeded_ex = 0
    start_time = time.time()
    if (page_size is None):
        if (limit and (read_capacity_to_consume_per_second > limit)):
            page_size = limit
        else:
            page_size = read_capacity_to_consume_per_second
    while True:
        if rate_available:
            try:
                data = self.scan(table_name, filter_condition=filter_condition, attributes_to_get=attributes_to_get, exclusive_start_key=last_evaluated_key, limit=page_size, conditional_operator=conditional_operator, return_consumed_capacity=TOTAL, scan_filter=scan_filter, segment=segment, total_segments=total_segments, consistent_read=consistent_read, index_name=index_name)
                for item in data.get(ITEMS):
                    (yield item)
                    if (limit is not None):
                        limit -= 1
                        if (not limit):
                            return
                if (CONSUMED_CAPACITY in data):
                    latest_scan_consumed_capacity = data.get(CONSUMED_CAPACITY).get(CAPACITY_UNITS)
                elif allow_rate_limited_scan_without_consumed_capacity:
                    latest_scan_consumed_capacity = 0
                else:
                    raise ScanError('Rate limited scan not possible because the server did not send backconsumed capacity information. If you wish scans to complete anywaywithout functioning rate limiting, set allow_rate_limited_scan_without_consumed_capacity to True in settings.')
                last_evaluated_key = data.get(LAST_EVALUATED_KEY, None)
                consecutive_provision_throughput_exceeded_ex = 0
            except ScanError as e:
                if isinstance(e.cause, ClientError):
                    code = e.cause.response['Error'].get('Code')
                    if (code == 'ProvisionedThroughputExceededException'):
                        consecutive_provision_throughput_exceeded_ex += 1
                        if (consecutive_provision_throughput_exceeded_ex > max_consecutive_exceptions):
                            raise
                    else:
                        raise
                else:
                    raise
        if ((not last_evaluated_key) and (consecutive_provision_throughput_exceeded_ex == 0)):
            return
        current_time = time.time()
        elapsed_time_ms = max(1, round(((current_time - start_time) * 1000)))
        if (consecutive_provision_throughput_exceeded_ex == 0):
            total_consumed_read_capacity += latest_scan_consumed_capacity
            consumed_rate = (total_consumed_read_capacity / elapsed_time_ms)
            rate_available = ((read_capacity_to_consume_per_ms - consumed_rate) >= 0)
        if ((not rate_available) or (consecutive_provision_throughput_exceeded_ex > 0)):
            elapsed_time_s = math.ceil((elapsed_time_ms / 1000))
            time_to_sleep = max(1, round(((total_consumed_read_capacity / elapsed_time_s) / read_capacity_to_consume_per_second)))
            if (timeout_seconds and ((elapsed_time_s + time_to_sleep) > timeout_seconds)):
                raise ScanError('Input timeout value {0} has expired'.format(timeout_seconds))
            time.sleep(min(math.ceil(time_to_sleep), max_sleep_between_retry))
            latest_scan_consumed_capacity = 0