docs: def SoS_exec(script: str, _dict: dict = None,
               return_result: bool = True) -> None:
      '''Execute a statement.'''
      if _dict is None:
          _dict = env.sos_dict.dict()
  
      if not return_result:
          exec(
              compile(script, filename=stmtHash.hash(script), mode='exec'), _dict)
          return None
  
      try:
          stmts = list(ast.iter_child_nodes(ast.parse(script)))
          if not stmts:
              return
          if isinstance(stmts[-1], ast.Expr):
              # the last one is an expression and we will try to return the results
              # so we first execute the previous statements
              if len(stmts) > 1:
                  exec(
                      compile(
                          ast.Module(body=stmts[:-1]),
                          filename=stmtHash.hash(script),
                          mode="exec"), _dict)
              # then we eval the last one
              res = eval(
                  compile(
                      ast.Expression(body=stmts[-1].value),
                      filename=stmtHash.hash(script),
                      mode="eval"), _dict)
          else:
              # otherwise we just execute the entire code
              exec(
                  compile(script, filename=stmtHash.hash(script), mode='exec'),
                  _dict)
              res = None
      except SyntaxError as e:
          raise SyntaxError(f"Invalid code {script}: {e}")
  
      # if check_readonly:
      #    env.sos_dict.check_readonly_vars()
      return res