def referer_str(request):
 referrer = request.headers.get('Referer')
 if (referrer is None):
  return referrer
 return to_native_str(referrer, errors='replace')

def referer_str ( request ) : referrer = request . headers . get ( 'Referer' ) if ( referrer is None ) : return referrer return to_native_str ( referrer , errors = 'replace' )
return referer http header suitable for logging .