<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_declared_envs(ini):
 """Get the full list of envs from the tox ini. This notably also includes envs that aren't in the envlist, but are declared by having their own testenv:envname section. The envs are expected in a particular order. First the ones declared in the envlist, then the other testenvs in order. """

    tox_section_name = 'tox:tox' if ini.path.endswith('setup.cfg') else 'tox'
    tox_section = ini.sections.get(tox_section_name, {})
    envlist = split_env(tox_section.get('envlist', []))

    # Add additional envs that are declared as sections in the ini
    section_envs = [
        section[8:] for section in sorted(ini.sections, key=ini.lineof)
        if section.startswith('testenv:')
    ]

    return envlist + [env for env in section_envs if env not in envlist]