ENH: Add optional argument keep_index to dataframe melt method (merged master onto old PR)
This PR merges master onto @NiklasKeck's PR branch (#17440) to add an optional argument to keep_index to `pd.melt`. There is quite a bit of discussion between the following 2 PRs and issues:

Index gets lost when DataFrame melt method is used #17440
ENH: Add optional argument keep_index to dataframe melt method #17459
Melt enhance #17677

Please let me know if additional things need to be done to complete this PR

----

Setting keep_index to True will reuse the original DataFrame index +
names of melted columns as additional level. closes issue #17440

(cherry picked from commit 0c64bf0e5f145781c0f74fb93ffcd63a6d964bd9)

- [x] closes #xxxx
- [ ] tests added / passed
- [x] passes `black pandas`
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry

Based on the decrease in code coverage, I assume tests will need to be added here:

https://github.com/pandas-dev/pandas/blob/df2e0813e053cc5bc924b2292ea8918a6b27f0e2/pandas/tests/reshape/test_melt.py#L9

I'm unfamiliar with how the tests are actually structured, so if someone could provide some direction, I could put together a test for review. Yep tests are pretty much the most important part of any PR. If you can add someone can take a look @smsaladi this needs tests for the new behavior Closing as I think this is stale, but @smsaladi feel free to ping if you want to pick back up and address comments