@staticmethod<EOL><INDENT>def _sanitize_config(custom_config):<DEDENT>
if not isinstance(custom_config, dict):<EOL><INDENT>raise TypeError("<STR_LIT>"<EOL>% str(type(custom_config)))<EOL><DEDENT>sanitized = {}<EOL>for key, value in custom_config.items():<EOL><INDENT>if not isinstance(key, str):<EOL><INDENT>raise TypeError("<STR_LIT>"<EOL>% (str(type(key)), str(key)))<EOL><DEDENT>if isinstance(value, bool):<EOL><INDENT>sanitized[key] = "<STR_LIT:true>" if value else "<STR_LIT:false>"<EOL><DEDENT>elif isinstance(value, (str, int, float)):<EOL><INDENT>sanitized[key] = str(value)<EOL><DEDENT>else:<EOL><INDENT>sanitized[key] = value<EOL><DEDENT><DEDENT>return sanitized<EOL>
Checks whether ``custom_config`` is sane and returns a sanitized dict <str -> (str|object)>

        It checks if keys are all strings and sanitizes values of a given dictionary as follows:

        - If string, number or boolean is given as a value, it is converted to string.
          For string and number (int, float), it is converted to string by a built-in ``str()`` method.
          For a boolean value, ``True`` is converted to "true" instead of "True", and ``False`` is
          converted to "false" instead of "False", in order to keep the consistency with
          Java configuration.

        - If neither of the above is given as a value, it is inserted into the sanitized dict as it is.
          These values will need to be serialized before adding to a protobuf message.