added python code for normalizing matrix
updated for using new api