<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def safe_redirect(next_url, default=None):
 """Makes sure it's a legit site to redirect to. :param default: this is the default url or named url to redirect to in the event where next_url is not legit. """

    if is_legit_next_url(next_url):
        return redirect(next_url)

    if default:
        return redirect(default)

    return redirect('/')