    def store_target(self, anchor_name, target_counter_values, target_box):
        """Store a target called ``anchor_name``.

        If there is a pending TargetLookupItem, it is updated. Only previously
        collected anchors are stored.

        """
        item = self.target_lookup_items.get(anchor_name)
        if item and item.state == 'pending':
            item.state = 'up-to-date'
            item.target_box = target_box
            # Store the counter_values in the target_box like
            # compute_content_list does.
            if target_box.cached_counter_values is None:
                target_box.cached_counter_values = {
                    key: value.copy() for key, value
                    in target_counter_values.items()}
Store a target called ``anchor_name``.

If there is a pending TargetLookupItem, it is updated. Only previously
collected anchors are stored.
weasyprint/css/targets.py