def _is_internal_request(domain, referer):
 return ((referer is not None) and re.match(('^https?://%s/' % re.escape(domain)), referer))

def _is_internal_request ( domain , referer ) : return ( ( referer is not None ) and re . match ( ( '^https?://%s/' % re . escape ( domain ) ) , referer ) )
returns true if the referring url is the same domain as the current request .