def verifyReturnTo(realm_str, return_to, _vrfy=getAllowedReturnURLs):
 realm = TrustRoot.parse(realm_str)
 if (realm is None):
  return False
 try:
  allowable_urls = _vrfy(realm.buildDiscoveryURL())
 except RealmVerificationRedirected as err:
  oidutil.log(str(err))
  return False
 if returnToMatches(allowable_urls, return_to):
  return True
 else:
  oidutil.log(('Failed to validate return_to %r for realm %r, was not in %s' % (return_to, realm_str, allowable_urls)))
  return False

def verifyReturnTo ( realm_str , return_to , _vrfy = getAllowedReturnURLs ) : realm = TrustRoot . parse ( realm_str ) if ( realm is None ) : return False try : allowable_urls = _vrfy ( realm . buildDiscoveryURL ( ) ) except RealmVerificationRedirected as err : oidutil . log ( str ( err ) ) return False if returnToMatches ( allowable_urls , return_to ) : return True else : oidutil . log ( ( 'Failed to validate return_to %r for realm %r, was not in %s' % ( return_to , realm_str , allowable_urls ) ) ) return False
verify that a return_to url is valid for the given realm .