Which segment of the address matches the specified ip belongs to: Mei Jinsong program provides: hoxide because writing DNS server, according to the client's visit, returns the specified ip address so need to use the function .hoxide match ip addresses which belong to help achieve a python. I have grateful here. The code is as follows: Note: Hoxide indicates that this program is authorized. Class Netpool: Def __init __ (self): self.pool = dict () self.pool ['net'] = '0.0. 0.0 'DEF ADD (Self, IP): a = MAP (int, IP.Split ('. ')) P = Self.Pool for I in Range (LEN (A) -1, -1, -1): IF A [I]! = 0: k = i 1 Break for i in Range (k): = a [i] try: p = p [ia] except: p [ip] = dict () p = p [ IA] P ['net'] = IP DEF GET (Self, IP): a = MAP (int, ip.split ('.')) P = Self.pool ST = List () for IA IN A: TRY: IF IA == 0: St.Append (p) P = P [IA] Exce: Break St.Append (p) while st: p = st.pop () Try: Return P ['net'] Except : Pass Return 'No Such Net'