Added a new Python function for compute stratification