I've got a custom built class I created for a very similar purpose (in my case I was interested in "value" property changes, but I modified it to fit your "class" change example):
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
class WaitForAttrValueChange:
    def __init__(self, locator, val_):
        self.locator = locator
        self.val = val_
    def __call__(self, driver):
        try:
            attr_value = EC._find_element(driver, self.locator).get_property('className')
            return attr_value.startswith(self.val)
        except SE.StaleElementReferenceException:
            return False 
You can then use it with WebDriverWait(obviously you can use any By identification method instead of By.ID, this is just an example):
WebDriverWait(driver, 20).until(WaitForAttrValueChange((By.ID, 'id'), 'locked'))