1class Solution:2def validIPAddress(self, queryIP: str) -> str:3queryIP = queryIP.replace(".", ":")4ct = 05for i in queryIP.split(":"):6if i != "":7ct += 18if ct == 4:9for i in queryIP.split(":"):10if i == "":11return "Neither"12if i.isnumeric():13if len(i) > 1:14if i.count("0") == len(i) or int(i) > 255 or i[0] == "0":15return "Neither"16else:17return "Neither"18return "IPv4"19elif ct == 8:20a = ["a", "b", "c", "d", "e", "f", "A", "B", "C", "D", "E", "F"]21for i in queryIP.split(":"):22if i == "":23return "Neither"24if len(i) < 5:25for j in i:26if j not in a and j.isdigit() == False:27return "Neither"28else:29return "Neither"30return "IPv6"31else:32return "Neither"