'Generates a create index statement on \'table_name\' for a list of \'column_names\''

def create_index_sql(self, table_name, column_names, unique=False, db_tablespace=''):

    if (not column_names):
        print('No    column    names    supplied    on    which    to    create    an    index')
        return ''
    connection = self._get_connection()
    if (db_tablespace and connection.features.supports_tablespaces):
        tablespace_sql = ('    ' + connection.ops.tablespace_sql(db_tablespace))
    else:
        tablespace_sql = ''
    index_name = self.create_index_name(table_name, column_names)
    return ('CREATE    %sINDEX    %s    ON    %s    (%s)%s;' % (((unique and 'UNIQUE    ') or ''), self.quote_name(index_name), self.quote_name(table_name), ','.join([self.quote_name(field) for field in column_names]), tablespace_sql))
