code: def index_name(model, *field_names, **kwargs):
      
      if not len(field_names):
          raise ValueError("At least one field name required")
      using = kwargs.pop('using', DEFAULT_DB_ALIAS)
      if len(kwargs):
          raise ValueError("The only supported keyword argument is 'using'")
  
      existing_fields = {field.name: field for field in model._meta.fields}
      fields = [existing_fields[name] for name in field_names
                if name in existing_fields]
  
      if len(fields) != len(field_names):
          unfound_names = set(field_names) - {field.name for field in fields}
          raise ValueError("Fields do not exist: " + ",".join(unfound_names))
      column_names = tuple(field.column for field in fields)
      list_sql = get_list_sql(column_names)
  
      with connections[using].cursor() as cursor:
          cursor.execute(
              """SELECT `INDEX_NAME`, `SEQ_IN_INDEX`, `COLUMN_NAME`
                 FROM INFORMATION_SCHEMA.STATISTICS
                 WHERE TABLE_SCHEMA = DATABASE() AND
                       TABLE_NAME = %s AND
                       COLUMN_NAME IN {list_sql}
                 ORDER BY `INDEX_NAME`, `SEQ_IN_INDEX` ASC
              """.format(list_sql=list_sql),
              (model._meta.db_table,) + column_names,
          )
          indexes = defaultdict(list)
          for index_name, _, column_name in cursor.fetchall():
              indexes[index_name].append(column_name)
  
      indexes_by_columns = {tuple(v): k for k, v in indexes.items()}
      try:
          return indexes_by_columns[column_names]
      except KeyError:
          raise KeyError("There is no index on (" + ",".join(field_names) + ")")
docs: Returns the name of the index existing on field_names, or raises KeyError
      if no such index exists.