<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def assign_params(func, namespace):
 	""" 	Assign parameters from namespace where func solicits. 	2 3 	The usual errors are raised if a function doesn't receive 	its required parameters: 	Traceback (most recent call last):
 	It even works on methods: 	crystal 	"""

	try:
		sig = inspect.signature(func)
		params = sig.parameters.keys()
	except AttributeError:
		spec = inspect.getargspec(func)
		params = spec.args
	call_ns = {
		k: namespace[k]
		for k in params
		if k in namespace
	}
	return functools.partial(func, **call_ns)