Snapping using translate

Im trying to translate a vertex in 3D space while it should snap to closest point if it finds one.
I have tried with all the snapping parameters listed in the API can’t seem to make it work anyone has any idea? I have also forced to snapping mode with these lines:

  bpy.context.scene.tool_settings.snap_elements = {'VERTEX'}
  bpy.context.scene.tool_settings.snap_target = 'ACTIVE'
  bpy.context.scene.tool_settings.use_snap = True