def mapto_v6(addr):
 try:
  inet_pton(socket.AF_INET, addr)
  return '::ffff:{}'.format(addr)
 except socket.error:
  try:
   inet_pton(socket.AF_INET6, addr)
   return addr
  except socket.error:
   log.debug('%s is not a valid IP address.', addr)
 return None

def mapto_v6 ( addr ) : try : inet_pton ( socket . AF_INET , addr ) return '::ffff:{}' . format ( addr ) except socket . error : try : inet_pton ( socket . AF_INET6 , addr ) return addr except socket . error : log . debug ( '%s is not a valid IP address.' , addr ) return None
map an ipv4 address to an ipv6 one .