def aggregate_history(self, ip, days_limit=None):
first_date = None<EOL>last_date = None<EOL>prec_asn = None<EOL>prec_block = None<EOL>for entry in self.history(ip, days_limit):<EOL><INDENT>if entry is None:<EOL><INDENT>continue<EOL><DEDENT>date, asn, block = entry<EOL>if first_date is None:<EOL><INDENT>last_date = date<EOL>first_date = date<EOL>prec_asn = asn<EOL>prec_block = block<EOL><DEDENT>elif prec_asn == asn and prec_block == block:<EOL><INDENT>first_date = date<EOL><DEDENT>else:<EOL><INDENT>yield first_date, last_date, prec_asn, prec_block<EOL>last_date = date<EOL>first_date = date<EOL>prec_asn = asn<EOL>prec_block = block<EOL><DEDENT><DEDENT>if first_date is not None:<EOL><INDENT>yield first_date, last_date, prec_asn, prec_block<EOL><DEDENT>
Get the full history of an IP, aggregate the result instead of
returning one line per day.

:param ip: IP address to search for
:param days_limit: Max amount of days to query. (None means no limit)

:rtype: list. For each change: FirstDay, LastDay, ASN, Block