def metadata_parser(f):
	"""
	Parses a metadata file into dictionary.

	The metadata file is expected to have the following format:

	id;name;dtype

	where:
	- id denotes packet id (unsigned char or 1 byte uint)
	- name is the data channel name (str)
	- dtype is expected datatype (str)

	:param f: A file object with the path to metadata.
	:type f: file object

	:return: metadata, a dict where id and name is one-to-one, and both
	are keywords.
	"""
	metadata = {'ids': {}, 'names': {}}
	for line in f:
		line = line.strip().split(';')
		if (line[0] in metadata['ids'] or line[1] in metadata['names']):
			print('Warning: overlapping entry on id %s or name "%s"' % (line[0], line[1]))

		entry = {
				'id': int(line[0]),
				'name': line[1],
				'type': line[2]
				}

		metadata['ids'][line[0]] = entry
		metadata['names'][line[1]] = entry
	return metadata