'This is the entry point for the handler, it takes a request and response
and decides if it should follow the redirection or not.'

def http_error_default(self, req, resp, code, msg, hdrs):

    follow_redirects = getattr(req, 'follow_redirects', False)
    if (not follow_redirects):
        if self.redirect_allowed_by_rfc(req, code):
            return resp
        raise self.create_error_from_parts(req, code, msg, hdrs, resp)
    else:
        return self.do_follow_redirect(req, resp, code, msg, hdrs)
