how to check consistency of data in python