Setting Dynamic Links via python?

How can I set a dynamic link via python? I’ve tried variations of code like the code below, and it doesn’t seem to set the Dynamic Link

   dynamic_link = frappe.new_doc("Dynamic Link")
        dynamic_link.link_doctype = "Lead"
        dynamic_link.link_name = #"CRM-LEAD-2024-123123"
        dynamic_link.parenttype = "Address"
        dynamic_link.parent =

But Dynamic Link is the child table, it is not a parent doctype.