In the .ufl code you can to do something like this:
FE = FiniteElement('CG', cell, 1,)
TE = TensorElement('CG', cell, 1, shape=(2,2,2,2))
d = Coefficient(FE)
D = Coefficient(TE)
def C(d):
M11 = (1.0 - d)*(pow(2.0*d + 1.0, 0.5))
M12 = 0.5*(1.0 - d)*(2.0*d + 1.0)
D[0, 0, 0, 0] = M11
D[1, 1, 1, 1] = M11
D[0, 1, 0, 1] = M12
D[0, 1, 1, 0] = M12
D[1, 0, 0, 1] = M12
D[1, 0, 1, 0] = M12
return D
regards.