code: def saveSession(self, filepath):
          
          try:
              session_module.Save(self.session, filepath)
          except RuntimeError as e:
              log.exception(e)
              os.remove(filepath)
              log.warning("Session not saved")
docs: Save androguard session.