code: def _maybe_run_callbacks(self, latest_block):
          
          assert self.known_block_number is not None, 'known_block_number not set'
  
          latest_block_number = latest_block['number']
          missed_blocks = latest_block_number - self.known_block_number
  
          if missed_blocks < 0:
              log.critical(
                  'Block number decreased',
                  chain_id=self.chain_id,
                  known_block_number=self.known_block_number,
                  old_block_number=latest_block['number'],
                  old_gas_limit=latest_block['gasLimit'],
                  old_block_hash=to_hex(latest_block['hash']),
              )
          elif missed_blocks > 0:
              log_details = dict(
                  known_block_number=self.known_block_number,
                  latest_block_number=latest_block_number,
                  latest_block_hash=to_hex(latest_block['hash']),
                  latest_block_gas_limit=latest_block['gasLimit'],
              )
              if missed_blocks > 1:
                  log_details['num_missed_blocks'] = missed_blocks - 1
  
              log.debug(
                  'Received new block',
                  **log_details,
              )
  
              remove = list()
              for callback in self.callbacks:
                  result = callback(latest_block)
                  if result is REMOVE_CALLBACK:
                      remove.append(callback)
  
              for callback in remove:
                  self.callbacks.remove(callback)
  
              self.known_block_number = latest_block_number
docs: Run the callbacks if there is at least one new block.
  
          The callbacks are executed only if there is a new block, otherwise the
          filters may try to poll for an inexisting block number and the Ethereum
          client can return an JSON-RPC error.