def METHOD_NAME():
    # initialize "disconnection handling" code
    # base principle : sensitive methods ('first', 'count', 'all', '__iter__') are
    #  - renamed to _old_<method>
    #  - replaced by create_method
    # create_method then call _old_<method> on demand (see upper)
    for m in ['first', 'count', 'all', '__iter__']:
        try: # check if _old_<method> exists
            getattr(Query, '_old_%s' % m)
        except AttributeError: # and if not, create it
            setattr(Query, '_old_%s' % m, getattr(Query, m))
            setattr(Query, m, create_method(m))