def unpack(data, negotiated): communities = Communities() while data: if data and len(data) < 4: raise Notify(3, 1, 'could not decode community %s' % str([hex(_) for _ in data])) communities.add(Community.unpack(data[:4], negotiated)) data = data[4:] return communities
def unpack (data, negotiated): communities = Communities() while data: if data and len(data) < 4: raise Notify(3,1,'could not decode community %s' % str([hex(ord(_)) for _ in data])) communities.add(Community.unpack(data[:4],negotiated)) data = data[4:] return communities