text = "Hello. world. Hello!"
chunks = text.split('.', 2) # split the text twice
if len(chunks) > 2: # if there are more than 2 items
print( fr'{".".join(chunks[0:2])}_{chunks[2]}' )
else:
print(text) # Replace the second dot or print the original
dGV4dCA9ICJIZWxsby4gd29ybGQuIEhlbGxvISIgCmNodW5rcyA9IHRleHQuc3BsaXQoJy4nLCAyKSAjIHNwbGl0IHRoZSB0ZXh0IHR3aWNlCmlmIGxlbihjaHVua3MpID4gMjogICAgICAgICAjIGlmIHRoZXJlIGFyZSBtb3JlIHRoYW4gMiBpdGVtcwogICAgcHJpbnQoIGZyJ3siLiIuam9pbihjaHVua3NbMDoyXSl9X3tjaHVua3NbMl19JyApCmVsc2U6CglwcmludCh0ZXh0KSAgICAgICAgICAgICAjIFJlcGxhY2UgdGhlIHNlY29uZCBkb3Qgb3IgcHJpbnQgdGhlIG9yaWdpbmFsCg==