Higher order function to create simple portkey extension