def METHOD_NAME(param, op):
    c = ansatz(param)
    e = tc.templates.measurements.operator_expectation(c, op)
    # in operator_expectation, the "hamiltonian" can be sparse matrix, dense matrix or mpo
    return e