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

Following https://github.com/pandas-dev/pandas/pull/36852, I extracted validation of dialect into a separate function.
sure