code: func filterLogs(logs []*types.Log, fromBlock, toBlock *big.Int, addresses []common.Address, topics [][]common.Hash) []*types.Log {
  	var ret []*types.Log
  Logs:
  	for _, log := range logs {
  		if fromBlock != nil && fromBlock.Int64() >= 0 && fromBlock.Uint64() > log.BlockNumber {
  			continue
  		}
  		if toBlock != nil && toBlock.Int64() >= 0 && toBlock.Uint64() < log.BlockNumber {
  			continue
  		}
  
  		if len(addresses) > 0 && !includes(addresses, log.Address) {
  			continue
  		}
  		// If the to filtered topics is greater than the amount of topics in logs, skip.
  		if len(topics) > len(log.Topics) {
  			continue Logs
  		}
  		for i, sub := range topics {
  			match := len(sub) == 0 // empty rule set == wildcard
  			for _, topic := range sub {
  				if log.Topics[i] == topic {
  					match = true
  					break
  				}
  			}
  			if !match {
  				continue Logs
  			}
  		}
  		ret = append(ret, log)
  	}
  	return ret
  }
docs: // filterLogs creates a slice of logs matching the given criteria.