code: def check_collisions(
      caller, names, indices, override_protected_indices=None
  ):
      from hail.expr.expressions import ExpressionException
  
      fields = indices.source._fields
  
      if override_protected_indices is not None:
  
          def invalid(e):
              return e._indices in override_protected_indices
  
      else:
  
          def invalid(e):
              return e._indices != indices
  
      # check collisions with fields on other axes
      for name in names:
          if name in fields and invalid(fields[name]):
              msg = f"{caller!r}: name collision with field indexed by {list(fields[name]._indices.axes)}: {name!r}"
              error("Analysis exception: {}".format(msg))
              raise ExpressionException(msg)
  
      # check duplicate fields
      for k, v in Counter(names).items():
          if v > 1:
              from hail.expr.expressions import ExpressionException
  
              raise ExpressionException(
                  f"{caller!r}: selection would produce duplicate field {k!r}"
              )
  
imports: import atexit
  import datetime
  import difflib
  import json
  import os
  import re
  import secrets
  import shutil
  import string
  import tempfile
  from collections import defaultdict, Counter
  from contextlib import contextmanager
  from io import StringIO
  from typing import Optional, Literal
  from urllib.parse import urlparse
  import hail
  import hail
  from hail.typecheck import enumeration, typecheck, nullable
  from hail.utils.java import Env, error
label_desc: Use image node_id 21 for calling a global function with example usage: check_collisions(caller, names, indices, override_protected_indices) and returns: unknown, unknown