PyObject *instance = PyObject_GetAttrString(policy, "_obj_"); if (instance == nsnull) return nsnull;
nsresult GetDefaultGateway(PyObject *instance, REFNSIID iid, void **ret){	// NOTE: Instance is the real instance, _not_ the policy.	PyObject *ob_existing_weak = PyObject_GetAttrString(instance, PyXPCOM_szDefaultGatewayAttributeName);	if (ob_existing_weak != NULL) {		PRBool ok = PR_TRUE;		nsCOMPtr<nsIWeakReference> pWeakRef;		ok = NS_SUCCEEDED(Py_nsISupports::InterfaceFromPyObject(ob_existing_weak, 		                                       NS_GET_IID(nsIWeakReference), 		                                       getter_AddRefs(pWeakRef),		                                       PR_FALSE));		Py_DECREF(ob_existing_weak);		if (ok)			return pWeakRef->QueryReferent( iid, ret);	} else		PyErr_Clear();	return NS_ERROR_FAILURE;}