code: def extract_signature(sql):
      
      sql = force_text(sql)
      sql = sql.strip()
      first_space = sql.find(" ")
      if first_space < 0:
          return sql
  
      second_space = sql.find(" ", first_space + 1)
  
      sql_type = sql[0:first_space].upper()
  
      if sql_type in ["INSERT", "DELETE"]:
          keyword = "INTO" if sql_type == "INSERT" else "FROM"
          sql_type = sql_type + " " + keyword
  
          table_name = look_for_table(sql, keyword)
      elif sql_type in ["CREATE", "DROP"]:
          # 2nd word is part of SQL type
          sql_type = sql_type + sql[first_space:second_space]
          table_name = ""
      elif sql_type == "UPDATE":
          table_name = look_for_table(sql, "UPDATE")
      elif sql_type == "SELECT":
          # Name is first table
          try:
              sql_type = "SELECT FROM"
              table_name = look_for_table(sql, "FROM")
          except Exception:
              table_name = ""
      else:
          # No name
          table_name = ""
  
      signature = " ".join(filter(bool, [sql_type, table_name]))
      return signature
docs: Extracts a minimal signature from a given SQL query
      :param sql: the SQL statement
      :return: a string representing the signature