def fmt_type_name(data_type, inside_namespace=None):
if is_user_defined_type(data_type) or is_alias(data_type):<EOL><INDENT>if data_type.namespace == inside_namespace:<EOL><INDENT>return data_type.name<EOL><DEDENT>else:<EOL><INDENT>return '<STR_LIT>' % (data_type.namespace.name, data_type.name)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>fmted_type = _base_type_table.get(data_type.__class__, '<STR_LIT>')<EOL>if is_list_type(data_type):<EOL><INDENT>fmted_type += '<STR_LIT:<>' + fmt_type(data_type.data_type, inside_namespace) + '<STR_LIT:>>'<EOL><DEDENT>return fmted_type<EOL><DEDENT>
Produces a TypeScript type name for the given data type.
inside_namespace should be set to the namespace that the reference
occurs in, or None if this parameter is not relevant.