(self, token, tenant_id=None)
return s
:param unicode token: An authentication token previously created by
            session_for_api_key or session_for_username_password, or a new
            token initialized outside Mimic.

        :return: a session for the given token.
        :rtype: Session
:param unicode token: An authentication token previously created by
            session_for_api_key or session_for_username_password, or a new
            token initialized outside Mimic.
: param unicode token : An authentication token previously created by session_for_api_key or session_for_username_password or a new token initialized outside Mimic .
def session_for_token(self, token, tenant_id=None):
        """
        :param unicode token: An authentication token previously created by
            session_for_api_key or session_for_username_password, or a new
            token initialized outside Mimic.

        :return: a session for the given token.
        :rtype: Session
        """
        if token in self._token_to_session:
            s = self._token_to_session[token]
            self._assert_tenant_matches(s, tenant_id)
        elif tenant_id and tenant_id in self._tenant_to_session:
            s = self._tenant_to_session[tenant_id]
        else:
            s = self._new_session(token=token, tenant_id=tenant_id)
        return s
def session_for_token ( self , token , tenant_id = None ) : if token in self . _token_to_session : s = self . _token_to_session [ token ] self . _assert_tenant_matches ( s , tenant_id ) elif tenant_id and tenant_id in self . _tenant_to_session : s = self . _tenant_to_session [ tenant_id ] else : s = self . _new_session ( token = token , tenant_id = tenant_id ) return s