<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def install_from_rpm_py_package(self):
 """Run install from RPM Python binding RPM package."""

        self._download_and_extract_rpm_py_package()

        # Find ./usr/lib64/pythonN.N/site-packages/rpm directory.
        # A binary built by same version Python with used Python is target
        # for the safe installation.

        if self.rpm.has_set_up_py_in():
            # If RPM has setup.py.in, this strict check is okay.
            # Because we can still install from the source.
            py_dir_name = 'python{0}.{1}'.format(
                          sys.version_info[0], sys.version_info[1])
        else:
            # If RPM does not have setup.py.in such as CentOS6,
            # Only way to install is by different Python's RPM package.
            py_dir_name = '*'

        python_lib_dir_pattern = os.path.join(
                                'usr', '*', py_dir_name, 'site-packages')
        rpm_dir_pattern = os.path.join(python_lib_dir_pattern, 'rpm')
        downloaded_rpm_dirs = glob.glob(rpm_dir_pattern)
        if not downloaded_rpm_dirs:
            message = 'Directory with a pattern: {0} not found.'.format(
                    rpm_dir_pattern)
            raise RpmPyPackageNotFoundError(message)
        src_rpm_dir = downloaded_rpm_dirs[0]

        # Remove rpm directory for the possible installed directories.
        for rpm_dir in self.python.python_lib_rpm_dirs:
            if os.path.isdir(rpm_dir):
                Log.debug("Remove existing rpm directory {0}".format(rpm_dir))
                shutil.rmtree(rpm_dir)

        dst_rpm_dir = self.python.python_lib_rpm_dir
        Log.debug("Copy directory from '{0}' to '{1}'".format(
                  src_rpm_dir, dst_rpm_dir))
        shutil.copytree(src_rpm_dir, dst_rpm_dir)

        file_name_pattern = 'rpm-*.egg-info'
        rpm_egg_info_pattern = os.path.join(
                               python_lib_dir_pattern, file_name_pattern)
        downloaded_rpm_egg_infos = glob.glob(rpm_egg_info_pattern)
        if downloaded_rpm_egg_infos:
            existing_rpm_egg_info_pattern = os.path.join(
                self.python.python_lib_dir, file_name_pattern)
            existing_rpm_egg_infos = glob.glob(existing_rpm_egg_info_pattern)
            for existing_rpm_egg_info in existing_rpm_egg_infos:
                Log.debug("Remove existing rpm egg info file '{0}'".format(
                          existing_rpm_egg_info))
                os.remove(existing_rpm_egg_info)

            Log.debug("Copy file from '{0}' to '{1}'".format(
                      downloaded_rpm_egg_infos[0], self.python.python_lib_dir))
            shutil.copy2(downloaded_rpm_egg_infos[0],
                         self.python.python_lib_dir)