code: def symmetrize_compact_force_constants(force_constants,
                                         primitive,
                                         level=1):
      
  
      s2p_map = primitive.get_supercell_to_primitive_map()
      p2s_map = primitive.get_primitive_to_supercell_map()
      p2p_map = primitive.get_primitive_to_primitive_map()
      permutations = primitive.get_atomic_permutations()
      s2pp_map, nsym_list = get_nsym_list_and_s2pp(s2p_map,
                                                   p2p_map,
                                                   permutations)
      try:
          import phonopy._phonopy as phonoc
          phonoc.perm_trans_symmetrize_compact_fc(force_constants,
                                                  permutations,
                                                  s2pp_map,
                                                  p2s_map,
                                                  nsym_list,
                                                  level)
      except ImportError:
          text = ("Import error at phonoc.perm_trans_symmetrize_compact_fc. "
                  "Corresponding pytono code is not implemented.")
          raise RuntimeError(text)
docs: Symmetry force constants by translational and permutation symmetries
  
      Parameters
      ----------
      force_constants: ndarray
          Compact force constants. Symmetrized force constants are overwritten.
          dtype=double
          shape=(n_patom,n_satom,3,3)
      primitive: Primitive
          Primitive cell
      level: int
          Controls the number of times the following steps repeated:
          1) Subtract drift force constants along row and column
          2) Average fc and fc.T