code: def sign_all_unsigned_inputs(hex_privkey, unsigned_tx_hex):
      
      inputs, outputs, locktime, version = deserialize_transaction(unsigned_tx_hex)
      tx_hex = unsigned_tx_hex
      for index in xrange(0, len(inputs)):
          if len(inputs[index]['script_sig']) == 0:
  
              # tx with index i signed with privkey
              tx_hex = sign_transaction(str(unsigned_tx_hex), index, hex_privkey)
              unsigned_tx_hex = tx_hex
  
      return tx_hex
docs: Sign a serialized transaction's unsigned inputs
  
          @hex_privkey: private key that should sign inputs
          @unsigned_tx_hex: hex transaction with unsigned inputs
  
          Returns: signed hex transaction