def createVectorLikeThing(x, y, z):
    v = Vector((x, y, z))
up = Vector((0, 0, 1))
if v != -up:
    rot = up.rotation_difference(v)
else:
    rot = Quaternion((1, 0, 0), pi)
bpy.ops.mesh.primitive_cylinder_add(vertices=16, radius=0.01, depth=v.
    length, end_fill_type='NGON', view_align=False, enter_editmode=True)
bpy.ops.transform.translate(value=(0, 0, v.length / 2))
bpy.ops.object.editmode_toggle()
bpy.ops.transform.rotate(value=(rot.angle,), axis=rot.axis)
How can I use vectors to achieve the same as this