def get_safe_redirect_target(arg='<STR_LIT>'):
for target in request.args.get(arg), request.referrer:<EOL><INDENT>if not target:<EOL><INDENT>continue<EOL><DEDENT>if is_local_url(target):<EOL><INDENT>return target<EOL><DEDENT><DEDENT>return None<EOL>
Get URL to redirect to and ensure that it is local.