code: def strip_query(query: str) -> str:
      import re
  
      stripped_query = query.strip()
      # cut the hardcoded part (SELECT something IF)
      if query.lower().startswith("select"):
          try:
              stripped_query = re.split(
                  "if", query, maxsplit=1, flags=re.IGNORECASE
              )[1]
          except IndexError:
              stripped_query = ""
  
      if stripped_query:
          stripped_query = f"({stripped_query.strip()})"
  
      return stripped_query
  
imports: import logging
  from abc import abstractmethod
  from functools import lru_cache
  from datetime import datetime, timedelta
  from RestrictedPython import safe_builtins, utility_builtins, limited_builtins, compile_restricted
  from RestrictedPython.Eval import default_guarded_getitem
  from RestrictedPython.Guards import full_write_guard, guarded_iter_unpack_sequence, guarded_unpack_sequence
label_desc: Use image node_id 5 for calling a global function with example usage: strip_query(query) and returns: stripped_query