A converse Lyapunov theorem for nonlinear switched systems