How does the melt function work with Pandas DataFrame in Python?

I was learning about different Pandas functions which can be used on dataframes and can be used to change them and make them convert into a different format as per our needs. I came across a function named melt() but I am having difficulty understanding this function, what it does, where it is used, and how it is applied to dataframes. If anyone can please provide me with an explanation along with example codes, I would highly appreciate it, you can use built-in datasets like iris and breast_cancer and apply the function on them.