def is_internal_ip(context, prefix=None):
try:<EOL><INDENT>request = context['<STR_LIT>']<EOL>remote_ip = request.META.get('<STR_LIT>', '<STR_LIT>')<EOL>if not remote_ip:<EOL><INDENT>remote_ip = request.META.get('<STR_LIT>', '<STR_LIT>')<EOL><DEDENT>if not remote_ip:<EOL><INDENT>return False<EOL><DEDENT>internal_ips = None<EOL>if prefix is not None:<EOL><INDENT>internal_ips = getattr(settings, '<STR_LIT>' % prefix, None)<EOL><DEDENT>if internal_ips is None:<EOL><INDENT>internal_ips = getattr(settings, '<STR_LIT>', None)<EOL><DEDENT>if internal_ips is None:<EOL><INDENT>internal_ips = getattr(settings, '<STR_LIT>', None)<EOL><DEDENT>return remote_ip in (internal_ips or [])<EOL><DEDENT>except (KeyError, AttributeError):<EOL><INDENT>return False<EOL><DEDENT>
Return whether the visitor is coming from an internal IP address,
based on information from the template context.

The prefix is used to allow different analytics services to have
different notions of internal addresses.