import itertools


def get_all_combinations(param_opt):
	"""
	For a dictionary of potential parameter values, return an iterator 
	of dictionaries of all possible combinations
	
	Snatched from here: http://stackoverflow.com/questions/5228158/cartesian-product-of-a-dictionary-of-lists
	
	>>> d = get_all_combinations({'alpha': [.1, .25], 'alpha_decay': [-1, 500, 100]})
	>>> len(list(d))
	6
	>>> d = get_all_combinations({'alpha': [.1], 'alpha_decay': [-1, 500, 100]})
	>>> len(list(d))
	3
	
	>>> get_all_combinations({})
	{}
	>>> get_all_combinations(None)
	{}
	"""
	if not param_opt:
		return {}
	return (dict(zip(param_opt.keys(), x)) for x in itertools.product(*param_opt.values()))