diff --git a/binding/python/team/capi.i.in b/binding/python/team/capi.i.in
index c7a5842..6a0b4c4 100644
--- a/binding/python/team/capi.i.in
+++ b/binding/python/team/capi.i.in
@@ -45,13 +45,15 @@ int team_hwaddr_set(struct team_handle *th, uint32_t ifindex, const char *addr,
 %apply char *OUTPUT {char *addr};
 int team_hwaddr_get(struct team_handle *th, uint32_t ifindex, char *addr, unsigned int addr_len);
 
-%typemap(python, in) PyObject *PyFunc {
+#ifdef SWIG
+%typemap(in) PyObject *PyFunc {
   if (!PyCallable_Check($input)) {
       PyErr_SetString(PyExc_TypeError, "Need a callable object!");
       return NULL;
   }
   $1 = $input;
 }
+#endif
 
 %typemap(in) void (*func)(struct team_handle *, void *,
                           team_change_type_mask_t) {
