def METHOD_NAME(sender, instance, **kwargs):
    """
    Ensure document has the family pointer set.
    This sets the document's family if not overruled or set already.
    The family will be in the corresponding mutations when a tree
    structure is created or restructured.
    """
    # can't use instance.set_family() here as the instance isn't
    # in DB yet, causing integrity errors
    instance.family = instance