code: def setup_index(request, index_name):
      es = Elasticsearch()
      try:
          es.indices.create(index=index_name, body=MAPPINGS)
      except RequestError as e:
          if e.error == "resource_already_exists_exception":
              es.indices.delete(index_name)
          else:
              raise
  
      def fin():
          try:
              es.indices.delete(index_name)
          except NotFoundError:
              pass
  
      request.addfinalizer(fin)
  
imports: import pytest
  import os
  import hashlib
  from elasticsearch import Elasticsearch, ConnectionError, RequestError, NotFoundError
  from time import sleep
  from image_match.elasticsearch_driver import SignatureES
  from PIL import Image
label_desc: Use image node_id 2 for calling a global function with example usage: setup_index(request, index_name) without return types