'Return a copy of the current Query that\'s ready for another operation.
The klass argument changes the type of the Query, e.g. UpdateQuery.'

def chain(self, klass=None):

    obj = self.clone()
    if (klass and (obj.__class__ != klass)):
        obj.__class__ = klass
    if (not obj.filter_is_sticky):
        obj.used_aliases = set()
    obj.filter_is_sticky = False
    if hasattr(obj, '_setup_query'):
        obj._setup_query()
    return obj
