def _get_session(self, record=None, email=None, password=None, skip_cache=False):
        from tapiriik.auth.credential_storage import CredentialStore
        cached = self._sessionCache.Get(record.ExternalID if record else email)
        if cached and not skip_cache:
            return cached
        if record:
            #  longing for C style overloads...
            password = CredentialStore.Decrypt(record.ExtendedAuthorization["Password"])
            email = CredentialStore.Decrypt(record.ExtendedAuthorization["Email"])

        session = requests.Session()
        self._rate_limit()
        mPreResp = session.get(self._urlRoot + "/api/tapiriikProfile", allow_redirects=False)
        # New site gets this redirect, old one does not
        if mPreResp.status_code == 403:
            data = {
                "_username": email,
                "_password": password,
                "_remember_me": "true",
            }
            preResp = session.post(self._urlRoot + "/api/login", data=data)

            if preResp.status_code != 200:
                raise APIException("Login error %s %s" % (preResp.status_code, preResp.text))

            try:
                preResp = preResp.json()
            except ValueError:
                raise APIException("Parse error %s %s" % (preResp.status_code, preResp.text), block=True, user_exception=UserException(UserExceptionType.Authorization, intervention_required=True))

            if "success" not in preResp and "error" not in preResp:
                raise APIException("Login error", block=True, user_exception=UserException(UserExceptionType.Authorization, intervention_required=True))

            success = True
            error = ""

            if "success" in preResp:
                success = ["success"]

            if "error" in preResp:
                error = preResp["error"]

            if not success:
                logger.debug("Login error %s" % (error))
                raise APIException("Invalid login", block=True, user_exception=UserException(UserExceptionType.Authorization, intervention_required=True))

            # Double check


            self._rate_limit()
            mRedeemResp1 = session.get(self._urlRoot + "/api/tapiriikProfile", allow_redirects=False)
            if mRedeemResp1.status_code != 200:
                raise APIException("Motivato redeem error %s %s" % (mRedeemResp1.status_code, mRedeemResp1.text))

        else:
            logger.debug("code %s" % mPreResp.status_code)
            raise APIException((mPreResp.status_code, mPreResp.text) % "Unknown Motivato prestart response %s %s")

        self._sessionCache.Set(record.ExternalID if record else email, session)

        session.headers.update(self._obligatory_headers)

        return session
dataset/ETHPy150Open cpfair/tapiriik/tapiriik/services/Motivato/motivato.py/MotivatoService._get_session/swapped operands of `%`