def multiply_matrices(m1: list, m2: list) -> list:
    """Multiply two 3x3 matrices to produce the new ctm.

    A matrix is defined by 6 variables:
    [ a b 0 ]
    [ c d 0 ]
    [ e f 1 ]
    """
    a1, b1, c1, d1, e1, f1 = m1[0], m1[1], m1[2], m1[3], m1[4], m1[5]
    a2, b2, c2, d2, e2, f2 = m2[0], m2[1], m2[2], m2[3], m2[4], m2[5]
    a = a1 * a2 + b1 * c2
    b = a1 * b2 + b1 * d2
    c = c1 * a2 + d1 * c2
    d = c1 * b2 + d1 * d2
    e = e1 * a2 + f1 * c2 + e2
    f = e1 * b2 + f1 * d2 + f2
    return [a, b, c, d, e, f]
Multiply two 3x3 matrices to produce the new ctm.

    A matrix is defined by 6 variables:
    [ a b 0 ]
    [ c d 0 ]
    [ e f 1 ]
    
pdfsyntax/graphics.py