How to add a Texture to a Material using Python? It looks like it would be easy to add a texture to a material using Python, but no matter what i do i cant figure it out! 

I can create a texture using:

bpy.data.textures.new("NewTexture", type='IMAGE')


and I can create a new material texture slot:       

bpy.context.object.active_material.texture_slots.add()


However i can't link the texture to the Material Slot Texture. I have tried looking through the python API but nothing is working. I would be eternal grateful if someone could point me in the right direction.
Similar to material_slot.material, there is a texture_slot.texture

(I'm assuming Blender internal from the texture_slots.add in q)

mat = bpy.data.materials['Material']
tex = bpy.data.textures.new("SomeName", 'IMAGE')
slot = mat.texture_slots.add()
slot.texture = tex


A simple example using Cycles can be found here https://blender.stackexchange.com/a/14115/15543