code: def _ensure_no_embed_params(
      query_params: Dict[str, Union[List[str], str]], query_string: str
  ) -> str:
      """Ensures there are no embed params set (raises StreamlitAPIException) if there is a try,
      also makes sure old param values in query_string are preserved. Returns query_string : str.
      """
      # Get query params dict without embed, embed_options params
      query_params_without_embed = util.exclude_keys_in_dict(
          query_params, keys_to_exclude=EMBED_QUERY_PARAMS_KEYS
      )
      if query_params != query_params_without_embed:
          raise StreamlitAPIException(
              "Query param embed and embed_options (case-insensitive) cannot be set using set_query_params method."
          )
  
      all_current_params = parse.parse_qs(
          query_string, keep_blank_values=True
      )
      current_embed_params = parse.urlencode(
          {
              EMBED_QUERY_PARAM: [
                  param
                  for param in util.extract_key_query_params(
                      all_current_params, param_key=EMBED_QUERY_PARAM
                  )
              ],
              EMBED_OPTIONS_QUERY_PARAM: [
                  param
                  for param in util.extract_key_query_params(
                      all_current_params,
                      param_key=EMBED_OPTIONS_QUERY_PARAM,
                  )
              ],
          },
          doseq=True,
      )
      query_string = parse.urlencode(query_params, doseq=True)
  
      if query_string:
          separator = "&" if current_embed_params else ""
          return separator.join([query_string, current_embed_params])
      return current_embed_params
  
file_path: streamlit/lib/streamlit/commands/experimental_query_params.py
imports: import urllib.parse
  from typing import Any, Dict, List, Union
  from streamlit import util
  from streamlit.constants import EMBED_OPTIONS_QUERY_PARAM, EMBED_QUERY_PARAM, EMBED_QUERY_PARAMS_KEYS
  from streamlit.errors import StreamlitAPIException
  from streamlit.proto.ForwardMsg_pb2 import ForwardMsg
  from streamlit.runtime.metrics_util import gather_metrics
  from streamlit.runtime.scriptrunner import get_script_run_ctx
label_desc: Use image node_id 3 for calling a global function with example usage: _ensure_no_embed_params(query_params, query_string) and returns: current_embed_params, separator