def params(f):
	"""
	Read header parameters like ## key=value into a dictionary
	:param f: file handler
	:return: {key: value}
	"""

	params = {}
	pos = f.tell()
	line = f.readline()
	while line.startswith("#") or line == "\n":
		if line.startswith("##"):
			line = line[2:].rstrip("\n")
			try:
				idx = line.index("=")
				key = line[0:idx].lstrip()
				value = line[idx + 1:]
				params[key] = value
			except:
				pass
		pos = f.tell()
		line = f.readline()
	f.seek(pos)

	return params