update example with better Python practices