protected function getDrupalPackage($operation)
    {
        if ($operation instanceof InstallOperation) {
            $package = $operation->getPackage();
        } elseif ($operation instanceof UpdateOperation) {
            $package = $operation->getTargetPackage();
        }
        if ($this->isDrupalPackage($package)) {
            return $package;
        }
        return null;
    }