How to user before_rename for existing doctype?

I found there is an option of renaming customer name (Customer Doctype). I would like to change something while someone rename customer name.

I found a method before_rename which could be helpful. But don’t know I can use it in existing doctype like Customer. Any idea?