<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def is_up_url(url, allow_redirects=False, timeout=5):
 r""" Check URL to see if it is a valid web page, return the redirected location if it is Returns: None if ConnectionError False if url is invalid (any HTTP error code) cleaned up URL (following redirects and possibly adding HTTP schema "http://") 'https://duckduckgo.com/' True True True False False """

    if not isinstance(url, basestring) or '.' not in url:
        return False
    normalized_url = prepend_http(url)
    session = requests.Session()
    session.mount(url, HTTPAdapter(max_retries=2))
    try:
        resp = session.get(normalized_url, allow_redirects=allow_redirects, timeout=timeout)
    except ConnectionError:
        return None
    except:
        return None
    if resp.status_code in (301, 302, 307) or resp.headers.get('location', None):
        return resp.headers.get('location', None)  # return redirected URL
    elif 100 <= resp.status_code < 400:
        return normalized_url  # return the original URL that was requested/visited
    else:
        return False