old_contents: 
  '''Communicate with local or remote peercoin-daemon via JSON-RPC'''
  
  from operator import itemgetter
  
  try:
      from peercoin_rpc import Client
  except:
      raise EnvironmentError("peercoin_rpc library is required for this to work,\
                              use pip to install it.")
  
  def select_inputs(cls, total_amount):
      '''finds apropriate utxo's to include in rawtx, while being careful
      to never spend old transactions with a lot of coin age.
      Argument is intiger, returns list of apropriate UTXO's'''
  
      utxo = []
      utxo_sum = float(-0.01) ## starts from negative due to minimal fee
      for tx in sorted(cls.listunspent(), key=itemgetter('confirmations')):
  
          utxo.append({
              "txid": tx["txid"],
              "vout": tx["vout"],
              "scriptSig": tx["scriptPubKey"],
              "amount": cls.gettransaction(tx["txid"])["amount"]
          })
  
          utxo_sum += float(tx["amount"])
          if utxo_sum >= total_amount:
              return utxo
  
      if utxo_sum < total_amount:
          raise ValueError("Not enough funds.")
  
  class RpcNode(Client):
  
      select_inputs = select_inputs
  
      @property
      def is_testnet(self):
          '''check if node is configured to use testnet or mainnet'''
  
          if self.getinfo()["testnet"] is True:
              return True
          else:
              return False
  
  
new_contents: 
  '''Communicate with local or remote peercoin-daemon via JSON-RPC'''
  
  from operator import itemgetter
  
  try:
      from peercoin_rpc import Client
  except:
      raise EnvironmentError("peercoin_rpc library is required for this to work,\
                              use pip to install it.")
  
  def select_inputs(cls, total_amount):
      '''finds apropriate utxo's to include in rawtx, while being careful
      to never spend old transactions with a lot of coin age.
      Argument is intiger, returns list of apropriate UTXO's'''
  
      utxo = []
      utxo_sum = float(-0.01) ## starts from negative due to minimal fee
      for tx in sorted(cls.listunspent(), key=itemgetter('confirmations')):
  
          utxo.append({
              "txid": tx["txid"],
              "vout": tx["vout"],
              "scriptSig": tx["scriptPubKey"],
              "amount": tx["amount"]
          })
  
          utxo_sum += float(tx["amount"])
          if utxo_sum >= total_amount:
              return {'utxos':utxo, 'total':utxo_sum}
  
      if utxo_sum < total_amount:
          raise ValueError("Not enough funds.")
  
  class RpcNode(Client):
  
      select_inputs = select_inputs
  
      @property
      def is_testnet(self):
          '''check if node is configured to use testnet or mainnet'''
  
          if self.getinfo()["testnet"] is True:
              return True
          else:
              return False
  
  
subject: Return dict with selected utxo list and total