<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_next_environment(env):
 """ Given an environment, return the next environment in the promotion hierarchy """

    config = _config_file()

    juicer.utils.Log.log_debug("Finding next environment...")

    if env not in config.sections():
        raise JuicerConfigError("%s is not a server configured in juicer.conf", env)

    section = dict(config.items(env))

    if 'promotes_to' not in section.keys():
        err = "Environment `%s` has no entry for `promotes_to`\nCheck man 5 juicer.conf." % env
        raise JuicerConfigError(err)

    return section['promotes_to']