code: def filter_spent_outputs(self, outputs):
          
          links = [o.to_dict() for o in outputs]
          txs = list(query.get_spending_transactions(self.connection, links))
          spends = {TransactionLink.from_dict(input_['fulfills'])
                    for tx in txs
                    for input_ in tx['inputs']}
          return [ff for ff in outputs if ff not in spends]
docs: Remove outputs that have been spent
  
          Args:
              outputs: list of TransactionLink