def prepare_request(self, kwargs):
if self.session_id is not None:<EOL><INDENT>actual = dt.datetime.now()<EOL>if (self.last_activity + self.inactivity_limit) < actual:<EOL><INDENT>if self.persist:<EOL><INDENT>self.create_session()<EOL>actual = dt.datetime.now()<EOL><DEDENT>else:<EOL><INDENT>raise RuntimeError('<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>')<EOL><DEDENT><DEDENT>self.last_activity = actual<EOL>headers = kwargs.get('<STR_LIT>')<EOL>if headers is None:<EOL><INDENT>kwargs['<STR_LIT>'] = headers = {}<EOL><DEDENT>headers['<STR_LIT>'] = self.session_id<EOL><DEDENT>
If session is in use, prepares the request headers and
         checks if the session is expired.