Both the node address and the validator address are Bech32 encodings of the same compressed public key with different human-readable parts (hrp).
import bech32
validator_address = "rv1q22ts4wderfhzham0vnzs93g68d5hal3g8yyvv06re8sn88er9ud7yrqayv"
print("Validator Address:", validator_address)
# Extract Valdidator HRP (rv) and Public Key
_hrp, public_key5 = bech32.bech32_decode(validator_address)
# Re-encode Public Key with Node HRP (rn)
node_address = bech32.bech32_encode("rn", public_key5)
print("Node Adddress:", node_address)
# Returns:
# Validator Adddress: rv1q22ts4wderfhzham0vnzs93g68d5hal3g8yyvv06re8sn88er9ud7yrqayv
# Node Address: rn1q22ts4wderfhzham0vnzs93g68d5hal3g8yyvv06re8sn88er9ud7us2dgj