def promote_unused_aliases(self, initial_refcounts, used_aliases):
        """
        Given a "before" copy of the alias_refcounts dictionary (as
        'initial_refcounts') and a collection of aliases that may have been
        changed or created, works out which aliases have been created since
        then and which ones haven't been used and promotes all of those
        aliases, plus any children of theirs in the alias tree, to outer joins.
        """
        for alias in self.tables:
            if used_aliases in alias and (alias not in initial_refcounts or
                    self.alias_refcount[alias] == initial_refcounts[alias]):
                self.promote_joins([alias])
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/django/db/models/sql/query.py/Query.promote_unused_aliases/swapped operands of `in`