generic function version of kwic