Python: What if no active_object?
Ok, got it! (sorry, couldn't post a comment since i haven't got an account)
This works what I searched for.
try:
   posemp = bpy.context.active_object.location
except:
   posemp = bpy.context.scene.cursor.location

bpy.ops.object.empty_add(type='PLAIN_AXES', location=posemp)