public static function getParentDn($dn)
    {
        $parts = self::explodeDn($dn, 0);
        if (count($parts) === 1) {
            throw new InvalidArgumentException(sprintf('DN "%s" has no parent.', $dn));
        }
        array_shift($parts);
    
        return self::implodeDn($parts);
    }