code: def symmetry_measure(points_distorted, points_perfect):
      
      # When there is only one point, the symmetry measure is 0.0 by definition
      if len(points_distorted) == 1:
          return {'symmetry_measure': 0.0, 'scaling_factor': None, 'rotation_matrix': None}
      # Find the rotation matrix that aligns the distorted points to the perfect points in a least-square sense.
      rot = find_rotation(points_distorted=points_distorted,
                             points_perfect=points_perfect)
      # Find the scaling factor between the distorted points and the perfect points in a least-square sense.
      scaling_factor, rotated_coords, points_perfect = find_scaling_factor(points_distorted=points_distorted,
                                                                           points_perfect=points_perfect,
                                                                           rot=rot)
      # Compute the continuous symmetry measure [see Eq. 1 in Pinsky et al., Inorganic Chemistry 37, 5575 (1998)]
      rotated_coords = scaling_factor * rotated_coords
      diff = points_perfect - rotated_coords
      num = np.tensordot(diff, diff)
      denom = np.tensordot(points_perfect, points_perfect)
      return {'symmetry_measure': num / denom * 100.0, 'scaling_factor': scaling_factor, 'rotation_matrix': rot}
docs: Computes the continuous symmetry measure of the (distorted) set of points "points_distorted" with respect to the
      (perfect) set of points "points_perfect".
      :param points_distorted: List of points describing a given (distorted) polyhedron for which the symmetry measure
                               has to be computed with respect to the model polyhedron described by the list of points
                               "points_perfect".
      :param points_perfect: List of "perfect" points describing a given model polyhedron.
      :return: The continuous symmetry measure of the distorted polyhedron with respect to the perfect polyhedron