boto and load autoscaling groups

In boto, get_all_groups has a max return of 100. to get past that, you use tokens:

asconn = boto.ec2.autoscale.connect_to_region(self.region_name)
# This will load all groups.
# Source: http://stackoverflow.com/questions/29317526/how-can-i-retrieve-more-than-50-autoscaling-groups-via-python-boto
all_groups = []
rs = asconn.get_all_groups()
all_groups.extend(rs)
while rs.next_token:
    rs = asconn.get_all_groups(next_token=rs.next_token)
    all_groups.extend(rs)
for asg in all_groups:
    print self.stack_name + " = " + asg.name