code: def transfer_to(self, to_account, amount, **transaction_kwargs):
          
          if not isinstance(amount, Money):
              raise TypeError("amount must be of type Money")
  
          if to_account.sign == 1 and to_account.type != self.TYPES.trading:
              # Transferring from two positive-signed accounts implies that
              # the caller wants to reduce the first account and increase the second
              # (which is opposite to the implicit behaviour)
              direction = -1
          elif self.type == self.TYPES.liability and to_account.type == self.TYPES.expense:
              # Transfers from liability -> asset accounts should reduce both.
              # For example, moving money from Rent Payable (liability) to your Rent (expense) account
              # should use the funds you've built up in the liability account to pay off the expense account.
              direction = -1
          else:
              direction = 1
  
          transaction = Transaction.objects.create(**transaction_kwargs)
          Leg.objects.create(transaction=transaction, account=self, amount=+amount * direction)
          Leg.objects.create(transaction=transaction, account=to_account, amount=-amount * direction)
          return transaction
docs: Create a transaction which transfers amount to to_account
  
          This is a shortcut utility method which simplifies the process of
          transferring between accounts.
  
          This method attempts to perform the transaction in an intuitive manner.
          For example:
  
            * Transferring income -> income will result in the former decreasing and the latter increasing
            * Transferring asset (i.e. bank) -> income will result in the balance of both increasing
            * Transferring asset -> asset will result in the former decreasing and the latter increasing
  
          .. note::
  
              Transfers in any direction between ``{asset | expense} <-> {income | liability | equity}``
              will always result in both balances increasing. This may change in future if it is
              found to be unhelpful.
  
              Transfers to trading accounts will always behave as normal.
  
          Args:
  
              to_account (Account): The destination account.
              amount (Money): The amount to be transferred.
              transaction_kwargs: Passed through to transaction creation. Useful for setting the
                  transaction `description` field.