code: def get_gateway_socket(gateway):
      
      if not gateway:
          raise NATPMPNetworkError(NATPMP_GATEWAY_NO_VALID_GATEWAY,
                                   error_str(NATPMP_GATEWAY_NO_VALID_GATEWAY))
      response_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
      response_socket.setblocking(0)
      response_socket.connect((gateway, NATPMP_PORT))
      return response_socket
docs: Takes a gateway address string and returns a non-blocking UDP
         socket to communicate with its NAT-PMP implementation on
         NATPMP_PORT.
         
         e.g. addr = get_gateway_socket('10.0.1.1')