ENH: Raise TypeError for offsets which are not supported as period frequency
- [x] closes #55785
- [x] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [ ] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).

Added to constructor of `Period` check if frequency is supported as period frequency, if not a ValueError is raised.

The reason: so far we get
`AttributeError: 'pandas._libs.tslibs.offsets.QuarterBegin' object has no attribute '_period_dtype_code'`
Thanks @natmokval  @natmokval, does this PR also close: https://github.com/pandas-dev/pandas/issues/5091 ?  > @natmokval, does this PR also close: #5091 ?

@cancan101, I think, this PR doesn't close #5091. We still have the same behavior. For example, frequency  changes from 'ME' to 'MS':
```
>>> ts = pd.date_range('1/1/2012', periods=4, freq=pd.offsets.MonthEnd())
>>> per = ts.to_period()
>>> ts_per = per.to_timestamp()
>>> ts
DatetimeIndex(['2012-01-31', '2012-02-29', '2012-03-31', '2012-04-30'], dtype='datetime64[ns]', freq='ME')
>>> per
PeriodIndex(['2012-01', '2012-02', '2012-03', '2012-04'], dtype='period[M]')
>>> ts_per
DatetimeIndex(['2012-01-01', '2012-02-01', '2012-03-01', '2012-04-01'], dtype='datetime64[ns]', freq='MS')
```