<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def band_reorder(self):
 """ Re-order the eigenvalues according to the similarity of the eigenvectors """

        eiv = self.eigendisplacements
        eig = self.bands
    
        nphonons,nqpoints = self.bands.shape
        order = np.zeros([nqpoints,nphonons],dtype=int)
        order[0] = np.array(range(nphonons))
        
        #get the atomic masses
        atomic_masses = [ site.specie.atomic_mass for site in self.structure.sites ]
 
        #get order
        for nq in range(1,nqpoints):
            old_eiv = eigenvectors_from_displacements(eiv[:,nq-1],atomic_masses)
            new_eiv = eigenvectors_from_displacements(eiv[:,nq],  atomic_masses)
            order[nq] = estimate_band_connection(old_eiv.reshape([nphonons,nphonons]).T,
                                                 new_eiv.reshape([nphonons,nphonons]).T,
                                                 order[nq-1])

        #reorder
        for nq in range(1,nqpoints):
            eivq=eiv[:,nq]
            eigq=eig[:,nq]
            eiv[:,nq] = eivq[order[nq]]
            eig[:,nq] = eigq[order[nq]]