code: def _set_as_canonical_chain_head(cls, db: BaseDB, block_hash: Hash32
                                       ) -> Tuple[Tuple[BlockHeader, ...], Tuple[BlockHeader, ...]]:
          
          try:
              header = cls._get_block_header_by_hash(db, block_hash)
          except HeaderNotFound:
              raise ValueError(
                  "Cannot use unknown block hash as canonical head: {}".format(block_hash)
              )
  
          new_canonical_headers = tuple(reversed(cls._find_new_ancestors(db, header)))
          old_canonical_headers = []
  
          for h in new_canonical_headers:
              try:
                  old_canonical_hash = cls._get_canonical_block_hash(db, h.block_number)
              except HeaderNotFound:
                  # no old_canonical block, and no more possible
                  break
              else:
                  old_canonical_header = cls._get_block_header_by_hash(db, old_canonical_hash)
                  old_canonical_headers.append(old_canonical_header)
  
          for h in new_canonical_headers:
              cls._add_block_number_to_hash_lookup(db, h)
  
          db.set(SchemaV1.make_canonical_head_hash_lookup_key(), header.hash)
  
          return new_canonical_headers, tuple(old_canonical_headers)
docs: Sets the canonical chain HEAD to the block header as specified by the
          given block hash.
  
          :return: a tuple of the headers that are newly in the canonical chain, and the headers that
              are no longer in the canonical chain