How to add object to a specific layer with Python? I have the following code which generates an object:

mesh = bpy.data.meshes.new("Raw Curve")  
mesh.from_pydata(self.rawCurve, edges, [])  # verts, edges, faces
mesh.update()  

profile_object = bpy.data.objects.new("Raw Curve", mesh)  
profile_object.data = mesh  # this line is redundant .. it simply overwrites .data  

scene = bpy.context.scene  
scene.objects.link(profile_object)


How can I add this object to a specific layer (e.g. to layer 2)?
#add to layer 2 first - needs to be on at least one layer
profile_object.layers[1] = True

#wipe other layers
for i in range(20):
    profile_object.layers[i] = (i == 1)