<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _emplace_pmrna(mrnas, parent, strict=False):
 """Retrieve the primary mRNA and discard all others."""

    mrnas.sort(key=lambda m: (m.cdslen, m.get_attribute('ID')))
    pmrna = mrnas.pop()
    if strict:
        parent.children = [pmrna]
    else:
        parent.children = [c for c in parent.children if c not in mrnas]