According to specs https://datatracker.ietf.org/doc/html/rfc8941#section-3.1 and here https://wicg.github.io/ua-client-hints/#http-headerdef-sec-ch-ua , the whitespace after the comma is optional.
My suggestion is to split by ',' and then trim whitespace after using .strip