'annotate \'remote\' in primaryjoin, secondaryjoin
when the \'remote_side\' or \'_local_remote_pairs\'
arguments are used.'

def _annotate_remote_from_args(self):

    if self._local_remote_pairs:
        if self._remote_side:
            raise sa_exc.ArgumentError('remote_side    argument    is    redundant    against    more    detailed    _local_remote_side    argument.')
        remote_side = [r for (l, r) in self._local_remote_pairs]
    else:
        remote_side = self._remote_side
    if self._refers_to_parent_table():
        self._annotate_selfref((lambda col: (col in remote_side)))
    else:
        def repl(element):
            if (element in remote_side):
                return element._annotate({'remote': True})
        self.primaryjoin = visitors.replacement_traverse(self.primaryjoin, {}, repl)
