code: def registerForeign(func, name=None, arity=None, flags=0):
      
      global cwraps
  
      if arity is None:
          arity = func.arity
  
      if name is None:
          name = func.__name__
  
      cwrap = _callbackWrapper(arity)
      fwrap = _foreignWrapper(func)
      fwrap2 = cwrap(fwrap)
      cwraps.append(fwrap2)
      return PL_register_foreign(name, arity, fwrap2, flags)
docs: Register a Python predicate
      ``func``: Function to be registered. The function should return a value in
      ``foreign_t``, ``True`` or ``False``.
      ``name`` : Name of the function. If this value is not used, ``func.func_name``
      should exist.
      ``arity``: Arity (number of arguments) of the function. If this value is not
      used, ``func.arity`` should exist.