import pickle


def save_calib(filename, calib_params): 
	""" Saves calibration parameters as '.pkl' file.

		Parameters
		----------
		filename : str
			Path to save file, must be '.pkl' extension
		calib_params : dict
			Calibration parameters to save

		Returns
		-------
		saved : bool
			Saved successfully.
	"""
	if type(calib_params) != dict:
			raise TypeError("calib_params must be 'dict'")

	output = open(filename, 'wb')

	try:
		pickle.dump(calib_params, output)
	except:
		raise IOError("filename must be '.pkl' extension")

	output.close()

	saved = True

	return saved