<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_to_environment(self, environment):
 """Add the router to the given environment."""

        self._env = environment._env
        self._userdata = ffi.new_handle(self)

        ENVIRONMENT_DATA[self._env].routers[self.name] = self

        lib.EnvAddRouterWithContext(
            self._env, self._name.encode(), self._priority,
            lib.query_function,
            lib.print_function,
            lib.getc_function,
            lib.ungetc_function,
            lib.exit_function,
            self._userdata)