code: def prepare_request(self, kwargs):
          
          if self.session_id is not None:
              actual = dt.datetime.now()
  
              if (self.last_activity + self.inactivity_limit) < actual:
                  # session expired
                  if self.persist:
                      # request new session
                      self.create_session()
                      actual = dt.datetime.now()
                  else:
                      # raise error and recommend to manualy refresh session
                      raise RuntimeError('A non Persistent Session is expired. '
                                         'For consistency reasons this exception is raised. '
                                         'Please try again with manual refresh of the session ')
              self.last_activity = actual
  
              headers = kwargs.get('headers')
              if headers is None:
                  kwargs['headers'] = headers = {}
              headers['workbook-session-id'] = self.session_id
docs: If session is in use, prepares the request headers and
           checks if the session is expired.