code: def as_cql_query(self):
          
          options = dict(self.index_options)
          index_target = options.pop("target")
          if self.kind != "CUSTOM":
              return "CREATE INDEX %s ON %s.%s (%s)" % (
                  protect_name(self.name),
                  protect_name(self.keyspace_name),
                  protect_name(self.table_name),
                  index_target)
          else:
              class_name = options.pop("class_name")
              ret = "CREATE CUSTOM INDEX %s ON %s.%s (%s) USING '%s'" % (
                  protect_name(self.name),
                  protect_name(self.keyspace_name),
                  protect_name(self.table_name),
                  index_target,
                  class_name)
              if options:
                  # PYTHON-1008: `ret` will always be a unicode
                  opts_cql_encoded = _encoder.cql_encode_all_types(options, as_text_type=True)
                  ret += " WITH OPTIONS = %s" % opts_cql_encoded
              return ret
docs: Returns a CQL query that can be used to recreate this index.