def loads(content):
    """Loads variable definitions from a string."""
    lines = _group_lines(line for line in content.split('\n'))
    lines = [
        (i, _parse_envfile_line(line))
        for i, line in lines if line.strip()
    ]
    errors = []
    # Reject files with duplicate variables (no sane default).
    duplicates = _find_duplicates(((i, line[0]) for i, line in lines))
    for i, variable, j in duplicates:
        errors.append(''.join([
                'Line %d: duplicate environment variable "%s": ',
                'already appears on line %d.',
            ]) % (i + 1, variable, j + 1)
        )
    # Done!
    if errors:
        raise ValueError(errors)
    return {k: v for _, (k, v) in lines}
Loads variable definitions from a string.