def sort_wc(w_c, sort_key):
	"""Sorts the dictionary and returns sorted dictionary

	Args; dictionary, 0 or 1
	0 - sort by key
	1 - sort by value

	Return
	sorted dictionary

	"""
	sorted_w_c = {}
    # sorted is a built in function and returns a sorted list
	# if sort_key is 1 - sort on value in the dictionary
	# if sort_key is 0 - sort on key in the dictionary
	if sort_key == 1:
		sorted_list = sorted(w_c, key=w_c.get, reverse = True)
	else:
		sorted_list = sorted(w_c, reverse = True)

	#build the sorted dictionary
	for word in sorted_list:
		sorted_w_c[word] = w_c[word]

	return(sorted_w_c)