How do I write a script to convert tracks to F-Curves?

I’m working on a project that involves combining mocap animation for the face with a rigify rig for the rest of the body. After a lot of trial and error and dead-ends, I realised that the best way is to convert the tracks from the mocap into F-Curves that can then be applied to the bones, edited and so on. There is a button in the Link Empty to Track constraint for just this purpose.

However, it takes a looooong time to do - 10-15 minutes per track for a 1000 frame proof of concept animation. So I’d like to script this so that I can have it running in the background, and if it takes several days to convert the tracks for the final product, so be it - I can get on with other things.

I checked the console and the command for the conversions seems to be:
bpy.ops.clip.constraint_to_fcurve()

So what I want to know mainly is how to reference the track in this command.

Also, because I’m quite new to Python, how would I set up an array of track names, a “for loop” or “while loop” (or whatever they’re called in Python) and get the command to cycle through the array?

Many thanks in advance for any help.