Time depended Neumann boundary

I am follow the How to apply time varying boundary conditions coming from a function?

I test this with two def, one is exp(t), another one is a long equation, but except t, all other letters are defined, which are numbers.

blast=Constant((Po*(1-t/t1)*exp(-b*((t-t2)/t1)))/E)
def blast_func(t):
    return (Po*(1-t/t1)*exp(-b*((t-t2)/t1)))/E

pexp=Constant(exp(t))
def complicate_func(t):
    return exp(t)

a = u*v*dx + dt*dt*c*c*inner(grad(u), grad(v))*dx
L = 2*u1*v*dx - u0*v*dx + pexp*v*ds

bc = DirichletBC(V, 0, rightbound)
#A, b = assemble_system(a, L, bc)

u=Function(V)
vtkfile1=File('wave/u.pvd')
vtkfile2=File('wave/v.pvd')

while t <= T:
    A, b = assemble_system(a, L, bc)
    solve(A, u.vector(), b)
    velocity = (u - u0) / dt
    u0.assign(u1)
    u1.assign(u)
    t += dt
    pexp.assign(complicate_func(t))
    blast.assign(blast_func(t))
    vtkfile1<<(u,t)
    vtkfile2 << (project(velocity, V), t)