ENH: Add allow_duplicates to MultiIndex.to_frame
- [x] tests added / passed
- [x] Ensure all linting tests pass, see [here](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit) for how to run them
- [x] whatsnew entry

Part of issue #45245 for multi-indexes with repeated level names.

Old behavior was to remove columns with repeated level names:

```
import pandas as pd
pd.MultiIndex.from_tuples([[1, 2]], names=["a", "a"]).to_frame()
     a
a a   
1 2  2
```

New behavior is to raise, unless `allow_duplicates` is `True`:

```
pd.MultiIndex.from_tuples([[1, 2]], names=["a", "a"]).to_frame(allow_duplicates=True)
     a  a
a a      
1 2  1  2
```

Note: The other issues in #45245
1. Missing column names. This has been left as it was:  the name is filled with the level number, n. This is different from many other methods that fill with level_n, but obviously needs discussing.
2. bool values: might be fixed by #45061 
Hello @johnzangwill! Thanks for updating this PR. We checked the lines you've touched for [PEP 8](https://www.python.org/dev/peps/pep-0008) issues, and found:







There are currently no PEP 8 issues detected in this Pull Request. Cheers! :beers: 

##### Comment last updated at 2022-01-20 11:35:58 UTC I have factored out a private Index._make_labels. It is just used in Index and MI to_frame (see my note above https://github.com/pandas-dev/pandas/pull/45318#discussion_r786047914)

A tiny change of behavior would be e.g. Index([0], name="") which would have been changed to 0 before. Now it is left as "" because I am looking for explicit None, rather than just Falsey.

The tests all seem to pass. This is as Green as CI allows...
@jreback Please see my note (https://github.com/pandas-dev/pandas/pull/44755#discussion_r786120819) . I think that you will find that my solution there is not so bad as you first thought. thanks @johnzangwill 