def stats(self, filter, limit, start=None):
<EOL>if filter == '<STR_LIT>':<EOL><INDENT>filter = '<STR_LIT>'<EOL><DEDENT>valid_filters = ('<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>')<EOL>if filter not in valid_filters:<EOL><INDENT>msg = '<STR_LIT>'.format('<STR_LIT:U+002CU+0020>'.join(valid_filters))<EOL>raise ValueError(msg)<EOL><DEDENT>data = dict(action='<STR_LIT>', filter=filter, limit=limit, start=start)<EOL>jsondata = self._api_request(params=data)<EOL>stats = DBStats(total_clicks=int(jsondata['<STR_LIT>']['<STR_LIT>']),<EOL>total_links=int(jsondata['<STR_LIT>']['<STR_LIT>']))<EOL>links = []<EOL>if '<STR_LIT>' in jsondata:<EOL><INDENT>for i in range(<NUM_LIT:1>, limit + <NUM_LIT:1>):<EOL><INDENT>key = '<STR_LIT>'.format(i)<EOL>links.append(_json_to_shortened_url(jsondata['<STR_LIT>'][key]))<EOL><DEDENT><DEDENT>return links, stats<EOL>
Get stats about links.

        Parameters:
            filter: 'top', 'bottom', 'rand', or 'last'.
            limit: Number of links to return from filter.
            start: Optional start number.

        Returns:
            Tuple containing list of ShortenedURLs and DBStats.

        Example:

            .. code-block:: python

                links, stats = yourls.stats(filter='top', limit=10)

        Raises:
            ValueError: Incorrect value for filter parameter.
            requests.exceptions.HTTPError: Generic HTTP Error