matrix multiplication in python using function