def ffi_callback(signature, name, **kwargs):
 def wrapper(func):
  if lib.Cryptography_STATIC_CALLBACKS:
   ffi.def_extern(name=name, **kwargs)(func)
   callback = getattr(lib, name)
  else:
   callback = ffi.callback(signature, **kwargs)(func)
  return callback
 return wrapper

def ffi_callback ( signature , name , ** kwargs ) : def wrapper ( func ) : if lib . Cryptography_STATIC_CALLBACKS : ffi . def_extern ( name = name , ** kwargs ) ( func ) callback = getattr ( lib , name ) else : callback = ffi . callback ( signature , ** kwargs ) ( func ) return callback return wrapper
callback dispatcher the ffi_callback() dispatcher keeps callbacks compatible between dynamic and static callbacks .