<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def _opts_to_dict(*opts):
	'''Convert a tuple of options returned from getopt into a dictionary.'''
	ret = {}
	for key, val in opts:
		if key[:2] == '--':
			key = key[2:]
		elif key[:1] == '-':
			key = key[1:]
		if val == '':
			val = True
		ret[key.replace('-','_')] = val
	return ret