<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def group_envs(envlist):
 """Group Tox environments for Travis CI builds Separate by Python version so that they can go in different Travis jobs: [('py36', 'int', ['py36-int']), ('py37', 'int', ['py37-int-snappy'])] Group unit tests and linting together: [('py27', 'unit', ['py27-unit', 'py27-lint'])] """

    groups = {}
    for env in envlist:
        envpy, category = env.split('-')[0:2]

        if category == 'lint':
            category = 'unit'

        try:
            groups[envpy, category].append(env)
        except KeyError:
            groups[envpy, category] = [env]

    return sorted((envpy, category, envs) for (envpy, category), envs in groups.items())