Get list of sequencer shot nodes and set trackstate (Maya Python API)

I am trying to get a list of shot nodes from the sequencer in Maya and then set their track state attribute, but I have not really used the Python API nor do I even understand how to print out the info.

https://help.autodesk.com/view/MAYAUL/2020/ENU/index.html?guid=__Nodes_shot_html

Here is what I have so far:

import maya.api.OpenMaya as newOM

it = newOM.MItDependencyNodes(newOM.MFn.kShot)
while not it.isDone():
    print(it.thisNode())
    it.thisNode().trackState = 18
    it.next()

Something like that:

import maya.api.OpenMaya as newOM

it = newOM.MItDependencyNodes(newOM.MFn.kShot)

while not it.isDone():
	# it.thisNode() will return the MObject to which you need to attach a function set
	# since kShot node is not a dag node attach a dependency node function set

	# Attach the function set for the current node (MObject)
	nodeFn = newOM.MFnDependencyNode(it.thisNode())

	# Get the plug from the function set node - its easy to string find it
	trackStatePlug = nodeFn.findPlug("trackState", False)
	trackStatePlug.setInt(18)

	# Print debug to confirm it worked
	print(nodeFn.name())
	print(trackStatePlug.name())
	print(trackStatePlug.asInt())

	it.next()