def get_if_raw_addr6(iff):
 r = filter((lambda x: ((x[2] == iff) and (x[1] == IPV6_ADDR_GLOBAL))), in6_getifaddr())
 if (len(r) == 0):
  return None
 else:
  r = r[0][0]
 return inet_pton(socket.AF_INET6, r)

def get_if_raw_addr6 ( iff ) : r = filter ( ( lambda x : ( ( x [ 2 ] == iff ) and ( x [ 1 ] == IPV6_ADDR_GLOBAL ) ) ) , in6_getifaddr ( ) ) if ( len ( r ) == 0 ) : return None else : r = r [ 0 ] [ 0 ] return inet_pton ( socket . AF_INET6 , r )
returns the main global unicast address associated with provided interface .