make_split_fun function

Create a custom splitting function