Helper functions for working with data in python