Selecting other vertices connected to a selected vertex of a mesh object
What you're looking for is the 'select_more' operator under bpy.ops.mesh:
bpy.ops.mesh.select_more(use_face_step = False)

We're using the use_face_step = False parameter, to ensure it only selects linked vertices, not linked vertices via linked faces.

If you don't want to use operators, you can also use bmesh in a slightly longer script:
import bpy, bmesh

# Assuming active object in edit mode (for bmesh.from_edit_mesh)
mesh = bpy.context.object.data
bm = bmesh.from_edit_mesh(mesh)
   
# Get active vertex (assuming there is only 1 selected)
last = bm.select_history[-1] # history.active doesn't exist anymore...
                             # and last is a list, of one element

# Select all connected edges
for e in last.link_edges: e.select = True
    
bm.select_flush(True) # will update face selection

# this line is needed to close bmesh and see the result of the selection
bmesh.update_edit_mesh(mesh)