Energy levels of an electron in the field of a finite dipole