in firebase_admin/_messaging_encoder.py [0:0]
def check_string_dict(cls, label, value):
"""Checks if the given value is a dictionary comprised only of string keys and values."""
if value is None or value == {}:
return None
if not isinstance(value, dict):
raise ValueError('{0} must be a dictionary.'.format(label))
non_str = [k for k in value if not isinstance(k, str)]
if non_str:
raise ValueError('{0} must not contain non-string keys.'.format(label))
non_str = [v for v in value.values() if not isinstance(v, str)]
if non_str:
raise ValueError('{0} must not contain non-string values.'.format(label))
return value