Make weighted_choice fit for python3