def validate_params(params, required_params, validate_values=False):
	"""
	Make sure the iterable params contains all elements of required_params
	If validate_values is True, make sure params[k] are set.
	If required_params is a dictionary, make sure params[k] are set to the values given
	
	>>> validate_params(['a','b','c'], ['a','b'])
	True
	>>> validate_params(['a','b','c'], ['a','b','d'])
	False
	>>> validate_params({'a':0,'b':1,'c':2}, ['a','b'])
	True
	>>> validate_params({'a':0,'b':1,'c':2}, ['a','b','d'])
	False
	>>> validate_params({'a':0,'b':1,'c':2}, ['a','b'], validate_values=True)
	True
	>>> validate_params({'a':0,'b':1,'c':2}, ['a','b','d'], validate_values=True)
	False
	>>> validate_params({'a':None,'b':1,'c':2}, ['a','b','d'], validate_values=True)
	False
	
	>>> validate_params({'a':0,'b':1,'c':2}, {'a':0,'b':2}, validate_values=False)
	True
	>>> validate_params({'a':0,'b':1,'c':2}, {'a':0,'b':2}, validate_values=True)
	False
	>>> validate_params({'a':0,'b':1,'c':2}, {'a':0,'b':1}, validate_values=True)
	True
	>>> validate_params({'a':None,'b':1,'c':2}, {'a':0,'b':1}, validate_values=True)
	False
	>>> validate_params({'a':None,'b':1,'c':2}, {'a':None,'b':1}, validate_values=True)
	True
	>>> validate_params({'a':0,'b':1,'c':2}, {'a':0,'b':1, 'd':2}, validate_values=True)
	False
	>>> validate_params({'a':None,'b':1,'c':2}, {'a':[0, None],'b':1, 'c':2}, validate_values=True)
	True

	"""
	# every key (or element) in required_params must be present in the given params
	for k in required_params:
		if k not in params: 
			return False
		elif validate_values:
			try:
				# see if we got a dictionary of parameters
				p_val = params.get(k)
			except AttributeError:
				# if it's not a dictionary, it doesn't have values, obviously
				return False
			# now we need to check if the given parameter value is valid
			try:
				req_vals = required_params.get(k)

				# check if there's a list of requirements
				try:
					if p_val not in req_vals:
						return False
				except TypeError:
					# check if it matches the required value
					if p_val != req_vals:
						return False
			except AttributeError:
				# if the requirements are not specified, just make sure it's set to something
				if p_val is None:
					return False
	# and if we pass all the checks for all the required_params, it's valid
	return True