def __check_table_rules(configuration):
    """ Do some basic checks on the configuration """
    for table_name in configuration['tables']:
        table = configuration['tables'][table_name]
        # Check that increase/decrease units is OK
        valid_units = ['percent', 'units']
        if table['increase_reads_unit'] not in valid_units:
            print('increase-reads-unit must be set to either percent or units')
            sys.exit(1)
        if table['decrease_reads_unit'] not in valid_units:
            print('decrease-reads-unit must be set to either percent or units')
            sys.exit(1)
        if table['increase_writes_unit'] not in valid_units:
            print(
                'increase-writes-unit must be set to either percent or units')
            sys.exit(1)
        if table['decrease_writes_unit'] not in valid_units:
            print(
                'decrease-writes-unit must be set to either percent or units')
            sys.exit(1)
        if ('increase_consumed_reads_unit' in table
                and table['increase_consumed_reads_unit']
                and table['increase_consumed_reads_unit'] not in valid_units):
            print(
                'increase-consumed-reads-unit must be set to '
                'either percent or units, or left unset')
            sys.exit(1)
        if ('increase_consumed_writes_unit' in table
                and table['increase_consumed_writes_unit']
                and table['increase_consumed_writes_unit'] not in valid_units):
            print(
                'increase-consumed-writes-unit must be set to '
                'either percent or units, or left unset')
            sys.exit(1)
        if ('increase_throttled_by_consumed_reads_unit' in table
                and table['increase_throttled_by_consumed_reads_unit']
                and table['increase_throttled_by_consumed_reads_unit']
                not in valid_units):
            print(
                'increase-throttled-by-consumed-reads-unit must be set to '
                'either percent or units, or left unset')
            sys.exit(1)
        if ('increase_throttled_by_consumed_writes_unit' in table
                and table['increase_throttled_by_consumed_writes_unit']
                and table['increase_throttled_by_consumed_writes_unit']
                not in valid_units):
            print(
                'increase-throttled-by-consumed-writes-unit must be set to '
                'either percent or units, or left unset')
            sys.exit(1)
        if ('increase_throttled_by_provisioned_reads_unit' in table
                and table['increase_throttled_by_provisioned_reads_unit']
                and table['increase_throttled_by_provisioned_reads_unit']
                not in valid_units):
            print(
                'increase-throttled-by-provisioned-reads-unit must be set to '
                'either percent or units, or left unset')
            sys.exit(1)
        if ('increase_throttled_by_provisioned_writes_unit' in table
                and table['increase_throttled_by_provisioned_writes_unit']
                and table['increase_throttled_by_provisioned_writes_unit']
                not in valid_units):
            print(
                'increase-throttled-by-provisioned-writes-unit must be set to '
                'either percent or units, or left unset')
            sys.exit(1)

        # Check lookback-window start
        if table['lookback_window_start'] < 1:
            print(
                'lookback-window-start must be a value higher than 1, '
                'as DynamoDB sends CloudWatch data every minute')
            sys.exit(1)

        # Check sns-message-types
        valid_sns_message_types = [
            'scale-up',
            'scale-down',
            'high-throughput-alarm',
            'low-throughput-alarm']

        if table['sns_message_types']:
            for sns_type in table['sns_message_types']:
                if sns_type not in valid_sns_message_types:
                    print('Warning: Invalid sns-message-type: {0}'.format(
                        sns_type))
                    table['sns_message_types'].remove(sns_type)

        # Ensure values > 0 for some important configuration options
        options = [
            'reads_lower_threshold',
            'reads_upper_threshold',
            'increase_reads_with',
            'decrease_reads_with',
            'writes_lower_threshold',
            'writes_upper_threshold',
            'increase_writes_with',
            'decrease_writes_with',
            'min_provisioned_reads',
            'max_provisioned_reads',
            'min_provisioned_writes',
            'max_provisioned_writes',
            'num_read_checks_before_scale_down',
            'num_write_checks_before_scale_down',
            'increase_consumed_reads_with',
            'increase_consumed_writes_with'
        ]
        # Config options without a mandatory default
        # should be allowed a None value
        non_default = [
            'increase_consumed_reads_with',
            'increase_consumed_writes_with'
        ]

        for option in options:
            if (option in non_default
                    and option in table
                    and table[option] and table[option] < 1):
                print('{0} may not be lower than 1 for table {1}'.format(
                    option, table_name))
                sys.exit(1)

            if (option in table
                    and option not in non_default
                    and table[option] < 1):
                print('{0} may not be lower than 1 for table {1}'.format(
                    option, table_name))
                sys.exit(1)

        if (int(table['min_provisioned_reads']) >
                int(table['max_provisioned_reads'])):
            print(
                'min_provisioned_reads ({0}) may not be higher than '
                'max_provisioned_reads ({1}) for table {2}'.format(
                    table['min_provisioned_reads'],
                    table['max_provisioned_reads'],
                    table_name))
            sys.exit(1)
        elif (int(table['min_provisioned_writes']) >
                int(table['max_provisioned_writes'])):
            print(
                'min_provisioned_writes ({0}) may not be higher than '
                'max_provisioned_writes ({1}) for table {2}'.format(
                    table['min_provisioned_writes'],
                    table['max_provisioned_writes'],
                    table_name))
            sys.exit(1)
Do some basic checks on the configuration