code: def upgrade_slice(slc: Slice):
      try:
          query_context = json.loads(slc.query_context)
      except json.decoder.JSONDecodeError:
          return
  
      query_context.get("form_data", {}).pop(
          "time_range_endpoints", None
      )
  
      if query_context.get("queries"):
          queries = query_context["queries"]
          for query in queries:
              query.get("extras", {}).pop("time_range_endpoints", None)
  
      slc.query_context = json.dumps(query_context)
  
      return slc
  
file_path: superset/superset/migrations/versions/2022-04-18_11-20_ad07e4fdbaba_rm_time_range_endpoints_from_qc_3.py
imports: import json
  import sqlalchemy
  from alembic import op
  from sqlalchemy.ext.declarative import declarative_base
  from superset import db
label_desc: Use image node_id 1 for calling a global function with example usage: upgrade_slice(slc) and returns: slc