def get_mock_config(config_dict=None):
if config_dict is None:<EOL><INDENT>return topology_pb2.Config()<EOL><DEDENT>proto_config = topology_pb2.Config()<EOL>config_serializer = PythonSerializer()<EOL>assert isinstance(config_dict, dict)<EOL>for key, value in config_dict.items():<EOL><INDENT>if isinstance(value, bool):<EOL><INDENT>kvs = proto_config.kvs.add()<EOL>kvs.key = key<EOL>kvs.value = "<STR_LIT:true>" if value else "<STR_LIT:false>"<EOL>kvs.type = topology_pb2.ConfigValueType.Value("<STR_LIT>")<EOL><DEDENT>elif isinstance(value, (str, int, float)):<EOL><INDENT>kvs = proto_config.kvs.add()<EOL>kvs.key = key<EOL>kvs.value = str(value)<EOL>kvs.type = topology_pb2.ConfigValueType.Value("<STR_LIT>")<EOL><DEDENT>else:<EOL><INDENT>kvs = proto_config.kvs.add()<EOL>kvs.key = key<EOL>kvs.serialized_value = config_serializer.serialize(value)<EOL>kvs.type = topology_pb2.ConfigValueType.Value("<STR_LIT>")<EOL><DEDENT><DEDENT>return proto_config<EOL>
Returns a protobuf Config object from topology_pb2