code: def smooth_normals(positions, normals):
      '''Assigns an averaged normal to each position based on all of the normals
      originally used for the position.
      '''
      lookup = defaultdict(list)
      for position, normal in zip(positions, normals):
          lookup[position].append(normal)
      result = []
      for position in positions:
          tx = ty = tz = 0
          for x, y, z in lookup[position]:
              tx += x
              ty += y
              tz += z
          d = (tx * tx + ty * ty + tz * tz) ** 0.5
          result.append((tx / d, ty / d, tz / d))
      return resulf smooth_normals(positions, normals):
      '''Assigns an averaged normal to each position based on all of the normals
      originally used for the position.
      '''
      lookup = defaultdict(list)
      for position, normal in zip(positions, normals):
          lookup[position].append(normal)
      result = []
      for position in positions:
          tx = ty = tz = 0
          for x, y, z in lookup[position]:
              tx += x
              ty += y
              tz += z
          d = (tx * tx + ty * ty + tz * tz) ** 0.5
          result.append((tx / d, ty / d, tz / d))
      return result
docs: Assigns an averaged normal to each position based on all of the normals
      originally used for the position.