python_example: simplify stride handling in cffi-numpy example and introduce functions