def METHOD_NAME(self, peer_id: bytes32, phs: List[bytes32], max_items: int) -> Set[bytes32]:
    """
    returns the puzzle hashes that were actually subscribed to. These may be
    fewer than requested in case:
    * there are duplicate puzzle_hashes
    * some puzzle hashes are already subscribed to
    * the max_items limit is exceeded
    """
    puzzle_hash_peers = self._peer_puzzle_hash.setdefault(peer_id, set())
    existing_sub_count = self._peer_sub_counter.setdefault(peer_id, 0)
    ret: Set[bytes32] = set()
    # if we've reached the limit on number of subscriptions, just bail
    if existing_sub_count >= max_items:
        log.info(
            "peer_id: %s reached max number of puzzle-hash subscriptions. "
            "Not all its coin states will be reported",
            peer_id,
        )
        return ret
    # decrement this counter as we go, to know if we've hit the limit of
    # number of subscriptions
    subscriptions_left = max_items - existing_sub_count
    for ph in phs:
        ph_sub = self._ph_subscriptions.setdefault(ph, set())
        if peer_id in ph_sub:
            continue
        ret.add(ph)
        ph_sub.add(peer_id)
        puzzle_hash_peers.add(ph)
        self._peer_sub_counter[peer_id] += 1
        subscriptions_left -= 1
        if subscriptions_left == 0:
            log.info(
                "peer_id: %s reached max number of puzzle-hash subscriptions. "
                "Not all its coin states will be reported",
                peer_id,
            )
            break
    return ret