def METHOD_NAME(config_schema_snapshot, config_type_key, printer, with_lines=True):
    line_break_fn = printer.line if with_lines else lambda string: printer.append(string + " ")
    config_type_snap = config_schema_snapshot.get_config_snap(config_type_key)
    kind = config_type_snap.kind
    if kind == ConfigTypeKind.ARRAY:
        printer.append("[")
        METHOD_NAME(config_schema_snapshot, config_type_snap.inner_type_key, printer)
        printer.append("]")
    elif kind == ConfigTypeKind.NONEABLE:
        METHOD_NAME(config_schema_snapshot, config_type_snap.inner_type_key, printer)
        printer.append("?")
    elif kind == ConfigTypeKind.SCALAR_UNION:
        printer.append("(")
        METHOD_NAME(config_schema_snapshot, config_type_snap.scalar_type_key, printer)
        printer.append(" | ")
        METHOD_NAME(config_schema_snapshot, config_type_snap.non_scalar_type_key, printer)
        printer.append(")")
    elif kind == ConfigTypeKind.MAP:
        # e.g.
        # {
        #   [String]: Int
        # }
        line_break_fn("{")
        with printer.with_indent():
            printer.append("[")
            # In a Map, the given_name stores the optional key_label_name
            if config_type_snap.given_name:
                printer.append(f"{config_type_snap.given_name}: ")
            METHOD_NAME(config_schema_snapshot, config_type_snap.key_type_key, printer)
            printer.append("]: ")
            METHOD_NAME(
                config_schema_snapshot,
                config_type_snap.inner_type_key,
                printer,
                with_lines=with_lines,
            )
            line_break_fn("")
        printer.append("}")
    elif ConfigTypeKind.has_fields(kind):
        line_break_fn("{")
        with printer.with_indent():
            for field_snap in sorted(config_type_snap.fields):
                name = field_snap.name
                if field_snap.is_required:
                    printer.append(name + ": ")
                else:
                    printer.append(name + "?: ")
                METHOD_NAME(
                    config_schema_snapshot,
                    field_snap.type_key,
                    printer,
                    with_lines=with_lines,
                )
                line_break_fn("")
        printer.append("}")
    elif config_type_snap.given_name:
        printer.append(config_type_snap.given_name)
    else:
        check.failed("not supported")