I have looking for some implementation of a z score function and found out this paper: article
According to the paper the variance is like that:
def ge