code: def is_safe_url(url, host=None):
      
      if not url:
          return False
      netloc = urlparse.urlparse(url)[1]
      return not netloc or netloc == host
docs: Return ``True`` if the url is a safe redirection.
  
      The safe redirection means that it doesn't point to a different host.
      Always returns ``False`` on an empty url.