def read_config(filename):
    """Read the content of filename and put flags and values in a
    dictionary. Each line in the file is either an empty line, a line starting
    with '#' or an attribute-value pair separated by a '=' sign. Returns the
    dictionary."""
    file = open(filename, 'r')
    config = {}
    for line in file:
        line = line.strip()
        if not line:
            continue
        if line.startswith('#'):
            continue
        (flag, value) = [s.strip() for s in line.split('=')]
        config[flag] = value
    file.close()
    return config