Updated PYLITH_METHOD_BEGIN to use PetscFunctionBeginUser.