Python version of NboScan code