code: protected function getCustomerGroupFromEvent(ResourceEventInterface $event)
      {
          $resource = $event->getResource();
  
          if (!$resource instanceof CustomerGroupInterface) {
              throw new InvalidArgumentException('Expected instance of ' . CustomerGroupInterface::class);
          }
  
          return $resource;
      }
docs: Returns the customer group from the event.
  
  @param ResourceEventInterface $event
  
  @return CustomerGroupInterface
  @throws InvalidArgumentException