Shortcut for response(302, location=location, ...)

    The status code must be in the 3xx range.

def redirect(location, code=302, **kw):
    """Shortcut for response(302, location=location, ...)

    The status code must be in the 3xx range."""
    if not 300 <= code < 400:
        raise ValueError("Not a 3xx status code: '%s'" % code)
    return response(code=code, location=location, **kw)