import json


def load_config_file(filename):
    """Return dictionary of parameters from config file."""
    try:
        fp = open(filename)
    except IOError:
        print("Error opening file " + filename)
        raise

    try:
        params = json.load(fp)
        return params
    except ValueError:
        print("Config file malformed.")
        raise
    finally:
        fp.close()