Base xhpy implementation.