def METHOD_NAME(grid, file_like):
    """Write the CELL_TYPES section (triangles or quads)"""
    file_like.write("CELL_TYPES " + str(grid.number_of_patches) + "\n")
    if len(grid.nodes_at_patch[0]) == 3:  # triangles
        cell_type = "5\n"  # vtk code for a triangle
    else:
        cell_type = "9\n"  # vtk code for a quad
    for _ in range(grid.number_of_patches):
        file_like.write(cell_type)
    file_like.write("\n")