<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def filter_curated_references(root, head, update):
 """Remove references from either ``head`` or ``update`` depending on curation. If references have been curated, then it removes all references from the update to keep the existing ones. Otherwise, it removes all references from the head to force replacement with the update ones. Args: root (pmap):
 the root record. head (pmap):
 the head record. update (pmap):
 the update record. Returns: tuple: ``(root, head, update)`` with ``references`` removed from ``root`` and either ``head`` or ``update``. """

    if 'references' not in head or 'references' not in update:
        return root, head, update

    references_curated = are_references_curated(root.get('references', []), head.get('references', []))
    if 'references' in root:
        root = root.remove('references')
    if references_curated:
        update = update.remove('references')
    else:
        head = head.remove('references')

    return root, head, update