'https://developers.google.com/appengine/docs/python/urlfetch/'

def filter(self, handler):

    if (handler.command == 'CONNECT'):
        do_ssl_handshake = ((440 <= handler.port <= 450) or (1024 <= handler.port <= 65535))
        alias = handler.net2.getaliasbyname(handler.path)
        if alias:
            return ('direct', {'cache_key': ('%s:%d' % (alias, handler.port)), 'headfirst': ('.google' in handler.host)})
        else:
            return ('strip', {'do_ssl_handshake': do_ssl_handshake})
    elif (handler.command in ('GET', 'POST', 'HEAD', 'PUT', 'DELETE', 'PATCH')):
        alias = handler.net2.getaliasbyname(handler.path)
        if alias:
            return ('direct', {'cache_key': ('%s:%d' % (alias, handler.port)), 'headfirst': ('.google' in handler.host)})
        else:
            return ('gae', {})
    elif ('php' in handler.handler_plugins):
        return ('php', {})
    else:
        logging.warning('"%s    %s"    not    supported    by    GAE,    please    enable    PHP    mode!', handler.command, handler.path)
        return ('direct', {})
