World timezone definitions by country subdivision (e.g., provinces or states)
The database is not authoritative, and it surely has errors. Corrections are welcome and encouraged.
As per usual:
pip install pytzsub
>>> from pytzsub import sub_timezone
>>> sub_timezone('US-CA')
'America/Los_Angeles'
>>> from pytzsub import all_code
>>> 'US-CA' in all_code()
True
>>> from pytzsub import sub_timezone
>>> from pytz import timezone
>>> tz = timezone(sub_timezone('CA-QC'))
>>> type(tz)
<class 'pytz.tzfile.America/Toronto'>
- Time Zone Database https://www.iana.org/time-zones
- ISO_3166-2 https://en.wikipedia.org/wiki/ISO_3166-2