<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def loads(content):
 """Load a Procfile from a string."""

    lines = _group_lines(line for line in content.split('\n'))
    lines = [
        (i, _parse_procfile_line(line))
        for i, line in lines if line.strip()
    ]
    errors = []
    # Reject files with duplicate process types (no sane default).
    duplicates = _find_duplicates(((i, line[0]) for i, line in lines))
    for i, process_type, j in duplicates:
        errors.append(''.join([
                'Line %d: duplicate process type "%s": ',
                'already appears on line %d.',
            ]) % (i + 1, process_type, j + 1)
        )
    # Reject commands with duplicate variables (no sane default).
    for i, line in lines:
        process_type, env = line[0], line[2]
        duplicates = _find_duplicates(((0, var[0]) for var in env))
        for _, variable, _ in duplicates:
            errors.append(''.join([
                    'Line %d: duplicate variable "%s" ',
                    'for process type "%s".',
                ]) % (i + 1, variable, process_type)
            )
    # Done!
    if errors:
        raise ValueError(errors)
    return {k: {'cmd': cmd, 'env': dict(env)} for _, (k, cmd, env) in lines}