'Update AS info on existing Nmap scan result documents'

def update_as(self, start, stop, asnum, asname, create=False):

    if (asname is None):
        updatespec = {'infos.as_num': asnum}
    else:
        updatespec = {'infos.as_num': asnum, 'infos.as_name': asname}
    for colname in [self.colname_hosts, self.colname_oldhosts]:
        self.db[colname].update(self.searchrange(start, stop), {'$set': updatespec}, multi=True)
