def format_data_type(self, data_type):
s = data_type.name<EOL>for type_class, key_list in self._data_type_map:<EOL><INDENT>if isinstance(data_type, type_class):<EOL><INDENT>args = []<EOL>for key in key_list:<EOL><INDENT>val = getattr(data_type, key)<EOL>if val is not None:<EOL><INDENT>if isinstance(val, AstTypeRef):<EOL><INDENT>sval = val.name<EOL><DEDENT>elif isinstance(val, DataType):<EOL><INDENT>sval = self.format_data_type(val)<EOL><DEDENT>else:<EOL><INDENT>sval = self.format_value(val)<EOL><DEDENT>args.append(key + '<STR_LIT:=>' + sval)<EOL><DEDENT><DEDENT>if args:<EOL><INDENT>s += '<STR_LIT:(>' + '<STR_LIT:U+002CU+0020>'.join(args) + '<STR_LIT:)>'<EOL><DEDENT>break<EOL><DEDENT><DEDENT>if data_type.nullable:<EOL><INDENT>s += '<STR_LIT:?>'<EOL><DEDENT>return s<EOL>
Helper function to format a data type.

        This returns the name if it's a struct or union, otherwise
        (i.e. for primitive types) it renders the name and the
        parameters.