class_docstr: A wallet stores the balance of a specific instrument on a specific exchange.
  
  Parameters
  ----------
  exchange : `Exchange`
      The exchange associated with this wallet.
  balance : `Quantity`
      The initial balance quantity for the wallet.
docstr: Transfers funds from one wallet to another.
  
  Parameters
  ----------
  source : `Wallet`
      The wallet in which funds will be transferred from
  target : `Wallet`
      The wallet in which funds will be transferred to
  quantity : `Quantity`
      The quantity to be transferred from the source to the target.
      In terms of the instrument of the source wallet.
  commission :  `Quantity`
      The commission to be taken from the source wallet for performing
      the transfer of funds.
  exchange_pair : `ExchangePair`
      The exchange pair associated with the transfer
  reason : str
      The reason for transferring the funds.
  
  Returns
  -------
  `Transfer`
      A transfer object describing the transaction.
  
  Raises
  ------
  Exception
      Raised if an equation that describes the conservation of funds
      is broken.
docstr_tok: ["Transfers","funds","from","one","wallet","to","another",".","Parameters","--","--","--","--","--","source",":","`","Wallet","`","The","wallet","in","which","funds","will","be","transferred","from","target",":","`","Wallet","`","The","wallet","in","which","funds","will","be","transferred","to","quantity",":","`","Quantity","`","The","quantity","to","be","transferred","from","the","source","to","the","target",".","In","terms","of","the","instrument","of","the","source","wallet",".","commission",":","`","Quantity","`","The","commission","to","be","taken","from","the","source","wallet","for","performing","the","transfer","of","funds",".","exchange_pair",":","`","ExchangePair","`","The","exchange","pair","associated","with","the","transfer","reason",":","str","The","reason","for","transferring","the","funds",".","Returns","--","--","--","-","`","Transfer","`","A","transfer","object","describing","the","transaction",".","Raises","--","--","--","Exception","Raised","if","an","equation","that","describes","the","conservation","of","funds","is","broken","."]
code: def transfer(
      source: "Wallet",
      target: "Wallet",
      quantity: "Quantity",
      commission: "Quantity",
      exchange_pair: "ExchangePair",
      reason: str,
  ) -> "Transfer":
      """Transfers funds from one wallet to another.
  
      Parameters
      ----------
      source : `Wallet`
          The wallet in which funds will be transferred from
      target : `Wallet`
          The wallet in which funds will be transferred to
      quantity : `Quantity`
          The quantity to be transferred from the source to the target.
          In terms of the instrument of the source wallet.
      commission :  `Quantity`
          The commission to be taken from the source wallet for performing
          the transfer of funds.
      exchange_pair : `ExchangePair`
          The exchange pair associated with the transfer
      reason : str
          The reason for transferring the funds.
  
      Returns
      -------
      `Transfer`
          A transfer object describing the transaction.
  
      Raises
      ------
      Exception
          Raised if an equation that describes the conservation of funds
          is broken.
      """
      quantity = quantity.quantize()
      commission = commission.quantize()
  
      pair = source.instrument / target.instrument
      poid = quantity.path_id
  
      lsb1 = source.locked.get(poid).size
      ltb1 = target.locked.get(poid, 0 * pair.quote).size
  
      if commission.as_float() > 0.0:
          commission = source.withdraw(commission, "COMMISSION")
  
      quantity = source.withdraw(quantity, "FILL ORDER")
  
      if quantity.instrument == exchange_pair.pair.base:
          instrument = exchange_pair.pair.quote
          converted_size = quantity.size / exchange_pair.price
      else:
          instrument = exchange_pair.pair.base
          converted_size = quantity.size * exchange_pair.price
  
      converted = Quantity(
          instrument, converted_size, quantity.path_id
      ).quantize()
  
      converted = target.deposit(
          converted,
          "TRADED {} {} @ {}".format(
              quantity, exchange_pair, exchange_pair.price
          ),
      )
  
      lsb2 = source.locked.get(poid).size
      ltb2 = target.locked.get(poid, 0 * pair.quote).size
  
      q = quantity.size
      c = commission.size
      cv = converted.size
      p = (
          exchange_pair.inverse_price
          if pair == exchange_pair.pair
          else exchange_pair.price
      )
  
      source_quantization = Decimal(10) ** -source.instrument.precision
      target_quantization = Decimal(10) ** -target.instrument.precision
  
      lhs = Decimal((lsb1 - lsb2) - (q + c)).quantize(
          source_quantization
      )
      rhs = Decimal(ltb2 - ltb1 - cv).quantize(target_quantization)
  
      lhs_eq_zero = np.isclose(
          float(lhs), 0, atol=float(source_quantization)
      )
      rhs_eq_zero = np.isclose(
          float(rhs), 0, atol=float(target_quantization)
      )
  
      if not lhs_eq_zero or not rhs_eq_zero:
          equation = "({} - {}) - ({} + {}) != ({} - {}) - {}   [LHS = {}, RHS = {}, Price = {}]".format(
              lsb1, lsb2, q, c, ltb2, ltb1, cv, lhs, rhs, p
          )
  
          raise Exception("Invalid Transfer: " + equation)
  
      return Transfer(quantity, commission, exchange_pair.price)
  
imports: from typing import Dict, Tuple
  from collections import namedtuple
  from decimal import Decimal
  import numpy
  from tensortrade.core import Identifiable
  from tensortrade.core.exceptions import InsufficientFunds, DoubleLockedQuantity, DoubleUnlockedQuantity, QuantityNotLocked
  from tensortrade.oms.instruments import Instrument, Quantity, ExchangePair
  from tensortrade.oms.orders import Order
  from tensortrade.oms.exchanges import Exchange
  from tensortrade.oms.wallets.ledger import Ledger
label_desc: Use image node_id 10 for calling the Wallet obj's underlying member method code with example usage: obj.transfer(source, target, quantity, commission, exchange_pair, reason) and returns: Transfer