def do_signing(tx, key_iters, p2sh_lookup, netcode):
    unsigned_before = tx.bad_signature_count()
    unsigned_after = unsigned_before
    if ((unsigned_before > 0) and key_iters):
        print('signing...', file=sys.stderr)
        sign_tx(tx, wif_iter(key_iters), p2sh_lookup=p2sh_lookup, netcode=netcode)
        unsigned_after = tx.bad_signature_count()
        if (unsigned_after > 0):
            print(('warning: %d TxIn items still unsigned' % unsigned_after), file=sys.stderr)
    return (unsigned_after == 0)
def do_signing(tx, key_iters, p2sh_lookup, netcode):
    unsigned_before = tx.bad_signature_count()
    unsigned_after = unsigned_before
    if ((unsigned_before > 0) and key_iters):
        print('signing...', file=sys.stderr)
        sign_tx(tx, wif_iter(key_iters), p2sh_lookup=p2sh_lookup, netcode=netcode)
        unsigned_after = tx.bad_signature_count()
        if (unsigned_after > 0):
            print(('warning: %d TxIn items still unsigned' % unsigned_after), file=sys.stderr)
    return (unsigned_after == 0)