Helpers function for mian module

Hello everyone

Is it possible to have a helpers module for the main.html?
In my 'main.html’, I have the line

<script type="text/javascript" src="//js.maxmind.com/js/apis/geoip2/v2.1/geoip2.js><script>;

and I would like this line to be executed only if there is an internet connection or if the header is not in localhost.

{{#if notLocalhost }}
        <script type="text/javascript" src="//js.maxmind.com/js/apis/geoip2/v2.1/geoip2.js><script>;
{{/if}}

If I put my script code between ‘if’ tags, where do I have to put the ‘notLocalhost’ helpers function?

Thank you for your answers.
YC