def read_config(fd):
    """Read a simple "key = value" config file."""

    config = {}

    for line in fd:
        line = line.strip()
        if not line or line.startswith('#') or '=' not in line:
            continue
        key, value = line.split('=', 1)
        key = key.strip()
        value = value.strip()
        config[key] = value
    return config