import configparser, os
from ast import literal_eval


def get_custom_parameters(file):
	"""
	Parses a custom parameter files
	"""
    
	conffile = configparser.ConfigParser(inline_comment_prefixes ="#")
	conffile.read(file)
	
	args = {}
	for section in conffile.sections():
		for param in conffile[section]:
			# literal_eval does not like strings, if crashes: set as (default) string
			try: args[param] = literal_eval(conffile[section][param])
			except: args[param] = conffile[section][param]

	return args