def from_config(config):
    matrix = {}
    variables = config.keys()
    for entries in product(*config.values()):
        combination = dict(zip(variables, entries))
        include = True
        for value in combination.values():
            for reducer in value.reducers:
                if reducer.pattern == '-':
                    match = not combination[reducer.variable].value
                else:
                    match = fnmatch(combination[reducer.variable].value, reducer.pattern)
                if match if reducer.is_exclude else not match:
                    include = False
        if include:
            key = '-'.join(entry.alias for entry in entries if entry.alias)
            data = dict(
                zip(variables, (entry.value for entry in entries))
            )
            if key in matrix and data != matrix[key]:
                raise DuplicateEnvironment(key, data, matrix[key])
            matrix[key] = data
    return matrix