Perform a full-table scan

        For many parameters you will want to reference the DynamoDB API:
        http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Scan.html

        Parameters
        ----------
        tablename : str
            Name of the table to scan
        expr_values : dict, optional
            See docs for ExpressionAttributeValues. See also: kwargs
        alias : dict, optional
            See docs for ExpressionAttributeNames
        attributes : str or list, optional
            See docs for ProjectionExpression. If list, it will be joined by
            commas.
        consistent : bool, optional
            Perform a strongly consistent read of the data (default False)
        select : str, optional
            See docs for Select
        index : str, optional
            The name of the index to query
        limit : int, optional
            Maximum number of items to return
        return_capacity : {NONE, INDEXES, TOTAL}, optional
            INDEXES will return the consumed capacity for indexes, TOTAL will
            return the consumed capacity for the table and the indexes.
            (default NONE)
        filter : str, optional
            See docs for FilterExpression
        segment : int, optional
            When doing a parallel scan, the unique thread identifier for this
            scan. If present, total_segments must also be present.
        total_segments : int, optional
            When doing a parallel scan, the total number of threads performing
            the scan.
        exclusive_start_key : dict, optional
            The ExclusiveStartKey to resume a previous query
        **kwargs : dict, optional
            If expr_values is not provided, the kwargs dict will be used as the
            ExpressionAttributeValues (a ':' will be automatically prepended to
            all keys).

        Examples
        --------

        .. code-block:: python

            connection.scan2('mytable', filter='contains(tags, :search)', search='text)
            connection.scan2('mytable', filter='id = :id', expr_values={':id': 'dsa'})

def scan2(self, tablename, expr_values=None, alias=None, attributes=None,
              consistent=False, select=None, index=None, limit=None,
              return_capacity=None, filter=False, segment=None,
              total_segments=None, exclusive_start_key=None, **kwargs):
        """
        Perform a full-table scan

        For many parameters you will want to reference the DynamoDB API:
        http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Scan.html

        Parameters
        ----------
        tablename : str
            Name of the table to scan
        expr_values : dict, optional
            See docs for ExpressionAttributeValues. See also: kwargs
        alias : dict, optional
            See docs for ExpressionAttributeNames
        attributes : str or list, optional
            See docs for ProjectionExpression. If list, it will be joined by
            commas.
        consistent : bool, optional
            Perform a strongly consistent read of the data (default False)
        select : str, optional
            See docs for Select
        index : str, optional
            The name of the index to query
        limit : int, optional
            Maximum number of items to return
        return_capacity : {NONE, INDEXES, TOTAL}, optional
            INDEXES will return the consumed capacity for indexes, TOTAL will
            return the consumed capacity for the table and the indexes.
            (default NONE)
        filter : str, optional
            See docs for FilterExpression
        segment : int, optional
            When doing a parallel scan, the unique thread identifier for this
            scan. If present, total_segments must also be present.
        total_segments : int, optional
            When doing a parallel scan, the total number of threads performing
            the scan.
        exclusive_start_key : dict, optional
            The ExclusiveStartKey to resume a previous query
        **kwargs : dict, optional
            If expr_values is not provided, the kwargs dict will be used as the
            ExpressionAttributeValues (a ':' will be automatically prepended to
            all keys).

        Examples
        --------

        .. code-block:: python

            connection.scan2('mytable', filter='contains(tags, :search)', search='text)
            connection.scan2('mytable', filter='id = :id', expr_values={':id': 'dsa'})

        """
        keywords = {
            'TableName': tablename,
            'ReturnConsumedCapacity': self._default_capacity(return_capacity),
            'ConsistentRead': consistent,
        }
        values = build_expression_values(self.dynamizer, expr_values, kwargs)
        if values:
            keywords['ExpressionAttributeValues'] = values
        if attributes is not None:
            if not isinstance(attributes, six.string_types):
                attributes = ', '.join(attributes)
            keywords['ProjectionExpression'] = attributes
        if index is not None:
            keywords['IndexName'] = index
        if alias:
            keywords['ExpressionAttributeNames'] = alias
        if select:
            keywords['Select'] = select
        if filter:
            keywords['FilterExpression'] = filter
        if segment is not None:
            keywords['Segment'] = segment
        if total_segments is not None:
            keywords['TotalSegments'] = total_segments
        if exclusive_start_key is not None:
            keywords['ExclusiveStartKey'] = \
                self.dynamizer.maybe_encode_keys(exclusive_start_key)
        if not isinstance(limit, Limit):
            limit = Limit(limit)

        if select == COUNT:
            return self._count('scan', limit, keywords)
        else:
            return ResultSet(self, limit, 'scan', **keywords)