def flatten(x, par = '', sep ='.'):
	"""
	Recursively flatten dictionary with parent key separator
	Use to flatten augmentation labels in DataFrame output

	Args:
		x (dict): with nested dictionaries.
		par (str): parent key placeholder for subsequent levels from root
		sep (str: '.', '|', etc): separator

	Returns:
		Flattened dictionary

	Example:
		x = {'Cookies' : {'milk' : 'Yes', 'beer' : 'No'}}
		par, sep = <defaults>
		output = {'Cookies.milk' : 'Yes', 'Cookies.beer' : 'No'}

	"""

	store = {}
	for k,v in x.items():
		if isinstance(v,dict):
			store = {**store, **flatten(v, par =  par + sep + k if par else k)}
		else:
			store[par + sep + k] = v
	return store