code: def _parse_addr(self, addr): 
          ''' Parses address and returns IP version. Raises exception on invalid argument '''
          ipv = 0
          try:
              socket.inet_pton(socket.AF_INET6, addr)
              # Convert ::FFFF:x.y.z.y to IPv4
              if addr.lower().startswith('::ffff:'):
                  try:
                      socket.inet_pton(socket.AF_INET, addr)
                      ipv = 4
                  except:
                      ipv = 6
              else:
                  ipv = 6
          except:
              socket.inet_pton(socket.AF_INET, addr)
              ipv = 4
          return ipf _parse_addr(self, addr): 
          ''' Parses address and returns IP version. Raises exception on invalid argument '''
          ipv = 0
          try:
              socket.inet_pton(socket.AF_INET6, addr)
              # Convert ::FFFF:x.y.z.y to IPv4
              if addr.lower().startswith('::ffff:'):
                  try:
                      socket.inet_pton(socket.AF_INET, addr)
                      ipv = 4
                  except:
                      ipv = 6
              else:
                  ipv = 6
          except:
              socket.inet_pton(socket.AF_INET, addr)
              ipv = 4
          return ipv
docs: Parses address and returns IP version. Raises exception on invalid argument