python helper functions