def _get_agent_key(self, proxy=None):
if self._proxy is None:<EOL><INDENT>self._proxy = proxy<EOL><DEDENT>if self._proxy is not None and self._proxy.has_effective_agent():<EOL><INDENT>agent_key = self._proxy.get_effective_agent_id()<EOL><DEDENT>else:<EOL><INDENT>agent_key = None<EOL><DEDENT>if agent_key not in self._provider_sessions:<EOL><INDENT>self._provider_sessions[agent_key] = dict()<EOL><DEDENT>return agent_key<EOL>
Gets an agent key for session management.

        Side effect of setting a new proxy if one is sent along,
        and initializing the provider session map if agent key has
        not been seen before