Parent object to empty object without selecting them manually

Add a cube at the origin.

#a=bpy.ops.mesh.primitive_cube_add()

Create an empty object.

#b=bpy.ops.object.empty_add(type=“SPHERE”)

#parent of a is b

I want parent them for using controller.
when i run this script create an cube with empty object and empty object parent of cube or any object that i was add in script …