Working on h measure for python by practicing first in R