docs: def sign_transaction(self, tx, master_password, path=''):
          """
          Args:
              tx: hex transaction to sign
              master_password: master password for BIP32 wallets. Can be either a
                  master_secret or a wif
              path (Optional[str]): optional path to the leaf address of the
                  BIP32 wallet. This allows us to retrieve private key for the
                  leaf address if one was used to construct the transaction.
          Returns:
              signed transaction
  
          .. note:: Only BIP32 hierarchical deterministic wallets are currently
              supported.
  
          """
          netcode = 'XTN' if self.testnet else 'BTC'
  
          # TODO review
          # check if its a wif
          try:
              BIP32Node.from_text(master_password)
              return bitcoin.signall(tx, master_password)
          except (AttributeError, EncodingError):
              # if its not get the wif from the master secret
              return bitcoin.signall(tx, BIP32Node.from_master_secret(master_password, netcode=netcode).subkey_for_path(path).wif())