def sumCardList(alist):
	"""Return the value of a blackjack hand.
	alist is an iterable with pydealer.card.Card elements."""
	current_sum = 0
	num_aces = 0
	used_aces = 0
	for card in alist:
		if card.value not in ('Jack', 'Queen', 'King', 'Ace'):
			current_sum += int(card.value)
		elif card.value in ('Jack', 'Queen', 'King'):
			current_sum += 10
		else:
			num_aces += 1
			current_sum += 11
	while current_sum > 21 and used_aces < num_aces:
		current_sum -= 10
		used_aces += 1
	return current_sum