Clear the symlinks for a feature in the symlinked path

def clear_feature_symlinks(self, feature_name):
        """ Clear the symlinks for a feature in the symlinked path """
        logger.debug("Clearing feature symlinks for %s" % feature_name)
        feature_path = self.install_directory(feature_name)
        for d in ('bin', 'lib'):
            if os.path.exists(os.path.join(self.root_dir, d)):
                for link in os.listdir(os.path.join(self.root_dir, d)):
                    path = os.path.join(self.root_dir, d, link)
                    if feature_path in os.path.realpath(path):
                        getattr(self, 'remove_from_%s' % d)(link)