python thread helping classes