import re


def load_config(file):
    """ Load a config file of the format key=value. """
    
    config = {}

    f = open(file, 'r')
    for line in f.readlines():
        if re.match("\s*$", line) or re.match("\s*\#", line):
            continue

        m = re.match("\s*(\S+)\s*=\s*(.+)$", line)
        if m:
            config[m.group(1)] = m.group(2).strip()

    return config