def METHOD_NAME(dim,file):
  fp = open(file,"w")
  print("%s file converted via surf_transform.py\n" % infile, file=fp)
  print(len(pts),"points", file=fp)
  if lines: print(len(lines),"lines", file=fp)
  if tris: print(len(tris),"triangles", file=fp)
  print("\nPoints\n", file=fp)
  if dim == 2:
    for i,pt in enumerate(pts):
      print(i+1,pt[0],pt[1], file=fp)
  else:
    for i,pt in enumerate(pts):
      print(i+1,pt[0],pt[1],pt[2], file=fp)
  if lines:
    print("\nLines\n", file=fp)
    for i,line in enumerate(lines):
      print(i+1,line[0]+1,line[1]+1, file=fp)
  if tris:
    print("\nTriangles\n", file=fp)
    for i,tri in enumerate(tris):
      print(i+1,tri[0]+1,tri[1]+1,tri[2]+1, file=fp)
  fp.close()