How do I "Lock Camera to View" using Python?
This code checks the "Lock Camera to View" box:

for area in bpy.context.screen.areas:
   if area.type == 'VIEW_3D':
      for space in area.spaces:
         if space.type == 'VIEW_3D':
            space.lock_camera = True