Check browser is in private browsing mode or not

@return {Boolean}
4608
function isPrivateBrowsingMode () {
  try {
    localStorage.setItem(TEST_KEY, '1')
    localStorage.removeItem(TEST_KEY)
    return false
  } catch (error) {
    return true
  }
}
1202423
function authNeeded () {

    if (args.write === true) {
      return true
    }

    if (args.channel.indexOf('private-') === 0) {
      return true
    }

    if (args.channel.indexOf('presence-') === 0) {
      return true
    }

    return false;
  }
328566
def is_private(self):
        
        return (self in IPv4Network('0.0.0.0/8') or
                self in IPv4Network('10.0.0.0/8') or
                self in IPv4Network('127.0.0.0/8') or
                self in IPv4Network('169.254.0.0/16') or
                self in IPv4Network('172.16.0.0/12') or
                self in IPv4Network('192.0.0.0/29') or
                self in IPv4Network('192.0.0.170/31') or
                self in IPv4Network('192.0.2.0/24') or
                self in IPv4Network('192.168.0.0/16') or
                self in IPv4Network('198.18.0.0/15') or
                self in IPv4Network('198.51.100.0/24') or
                self in IPv4Network('203.0.113.0/24') or
                self in IPv4Network('240.0.0.0/4') or
                self in IPv4Network('255.255.255.255/32'))
74402
function() {
            var userAgent = pgwBrowser.userAgent.toLowerCase();

            // Check browser type
            for (i in browserData) {
                var browserRegExp = new RegExp(browserData[i].identifier.toLowerCase());
                var browserRegExpResult = browserRegExp.exec(userAgent);

                if (browserRegExpResult != null && browserRegExpResult[1]) {
                    pgwBrowser.browser.name = browserData[i].name;
                    pgwBrowser.browser.group = browserData[i].group;

                    // Check version
                    if (browserData[i].versionIdentifier) {
                        var versionRegExp = new RegExp(browserData[i].versionIdentifier.toLowerCase());
                        var versionRegExpResult = versionRegExp.exec(userAgent);

                        if (versionRegExpResult != null && versionRegExpResult[1]) {
                            setBrowserVersion(versionRegExpResult[1]);
                        }

                    } else {
                        setBrowserVersion(browserRegExpResult[1]);
                    }

                    break;
                }
            }

            return true;
        }
475931
function() {
            var ua = navigator.userAgent, parsed;

            if (/*@cc_on@if(@_jscript_version>=5)!@end@*/0)
                return true;
                
            if (parsed = ua.match(/Chrome\/(\d+\.\d+\.\d+\.\d+)/))
                return parsed[1] >= '4.0.249.4' || 1 * parsed[1].split(".")[0] > 5;
            if ((parsed = ua.match(/Safari\/(\d+\.\d+)/)) && !/iPhone/.test(ua))
                return parsed[1] >= '525.13';
            if (/Opera/.test({}.toString.call(window.opera)))
                return opera.version() >= '10.00';
            if (parsed = ua.match(/rv:(\d+\.\d+\.\d+)[^b].*Gecko\//))
                return parsed[1] >= '1.9.1';

            return false;
        }
711394
public static function checkBrowserAmaya()
    {
        if (stripos(self::$userAgentString, 'amaya') !== false) {
            $aresult = explode('/', stristr(self::$userAgentString, 'Amaya'));
            if (isset($aresult[1])) {
                $aversion = explode(' ', $aresult[1]);
                self::$browser->setVersion($aversion[0]);
            }
            self::$browser->setName(Browser::AMAYA);

            return true;
        }

        return false;
    }
127761
def is_private(self):
        
        private_10 = IPv4Network(u'10.0.0.0/8')
        private_172 = IPv4Network(u'172.16.0.0/12')
        private_192 = IPv4Network(u'192.168.0.0/16')
        return (self in private_10 or
                self in private_172 or
                self in private_192)
762541
public static function checkBrowserYandex()
    {
        if (stripos(self::$userAgentString, 'YaBrowser') !== false) {
            $aresult = explode('/', stristr(self::$userAgentString, 'YaBrowser'));
            if (isset($aresult[1])) {
                $aversion = explode(' ', $aresult[1]);
                self::$browser->setVersion($aversion[0]);
            }
            self::$browser->setName(Browser::YANDEX);

            return true;
        }

        return false;
    }
1189256
function filterBrowsers (browsers, re) {
    return Object.keys(browsers).filter(function (key) {
        return re.test(key);
    });
}
1346157
function is_private()
    {
        $now = time();

        foreach ($this->subkeys as $subkey)
            if ($subkey->has_private)
                return true;

        return false;
    }
1103648
public function isPrivate(): bool
    {
        if ($this->is_private !== null) {
            return $this->is_private;
        }

        $this->is_private = false;
        foreach (static::$private_ranges as $range) {
            if ($this->isIn($range)) {
                $this->is_private = true;
                break;
            }
        }

        return $this->is_private;
    }
402136
@Override
	public boolean check(EmbeddedBrowser browser) {
		if (condition.check(browser)) {
			count.getAndIncrement();
		}
		return count.get() <= maxCount;
	}
1126785
function _isFirefox() {
    var n = window.navigator;
    return n.userAgent.indexOf('Firefox') > -1 && n.userAgent.indexOf('Seamonkey') == -1;
  }
1246680
function checkBrowser () {
        if (cordova.platformId === 'browser' && require('./isChrome')()) { // eslint-disable-line no-undef
            module.exports = window.requestFileSystem || window.webkitRequestFileSystem;
            return true;
        }
        return false;
    }
749718
function isHidden(option) {
  return option.hidden === true ||
         (option.value != null && option.value.hidden);
}
1154053
function detectBrowser (browsers, browserQuery) {
  var b = false;
  browserQuery = browserslist(browserQuery);
  for (var i = 0; i < browsers.length; i++) {
    for (var j = 0; j < browserQuery.length; j++) {
      if (browsers[i] === browserQuery[j]) {
        b = true;
        break;
      }
    }
    if (b) { break; }
  }
  return b;
}
813796
function isBrowserMS () {
  let result = false
  try {
    result = document.documentMode || /Edge/.test(navigator.userAgent)
  } catch (e) {} // eslint-disable-line no-empty

  return result
}