def _get_merge_keys(self):
left_keys = []<EOL>right_keys = []<EOL>join_names = []<EOL>right_drop = []<EOL>left_drop = []<EOL>left, right = self.left, self.right<EOL>is_lkey = lambda x: is_array_like(x) and len(x) == len(left)<EOL>is_rkey = lambda x: is_array_like(x) and len(x) == len(right)<EOL>if _any(self.left_on) and _any(self.right_on):<EOL><INDENT>for lk, rk in zip(self.left_on, self.right_on):<EOL><INDENT>if is_lkey(lk):<EOL><INDENT>left_keys.append(lk)<EOL>if is_rkey(rk):<EOL><INDENT>right_keys.append(rk)<EOL>join_names.append(None)  <EOL><DEDENT>else:<EOL><INDENT>if rk is not None:<EOL><INDENT>right_keys.append(<EOL>right._get_label_or_level_values(rk))<EOL>join_names.append(rk)<EOL><DEDENT>else:<EOL><INDENT>right_keys.append(right.index)<EOL>join_names.append(right.index.name)<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>if not is_rkey(rk):<EOL><INDENT>if rk is not None:<EOL><INDENT>right_keys.append(<EOL>right._get_label_or_level_values(rk))<EOL><DEDENT>else:<EOL><INDENT>right_keys.append(right.index)<EOL><DEDENT>if lk is not None and lk == rk:<EOL><INDENT>if len(left) > <NUM_LIT:0>:<EOL><INDENT>right_drop.append(rk)<EOL><DEDENT>else:<EOL><INDENT>left_drop.append(lk)<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>right_keys.append(rk)<EOL><DEDENT>if lk is not None:<EOL><INDENT>left_keys.append(left._get_label_or_level_values(lk))<EOL>join_names.append(lk)<EOL><DEDENT>else:<EOL><INDENT>left_keys.append(left.index)<EOL>join_names.append(left.index.name)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>elif _any(self.left_on):<EOL><INDENT>for k in self.left_on:<EOL><INDENT>if is_lkey(k):<EOL><INDENT>left_keys.append(k)<EOL>join_names.append(None)<EOL><DEDENT>else:<EOL><INDENT>left_keys.append(left._get_label_or_level_values(k))<EOL>join_names.append(k)<EOL><DEDENT><DEDENT>if isinstance(self.right.index, MultiIndex):<EOL><INDENT>right_keys = [lev._values.take(lev_codes) for lev, lev_codes<EOL>in zip(self.right.index.levels,<EOL>self.right.index.codes)]<EOL><DEDENT>else:<EOL><INDENT>right_keys = [self.right.index._values]<EOL><DEDENT><DEDENT>elif _any(self.right_on):<EOL><INDENT>for k in self.right_on:<EOL><INDENT>if is_rkey(k):<EOL><INDENT>right_keys.append(k)<EOL>join_names.append(None)<EOL><DEDENT>else:<EOL><INDENT>right_keys.append(right._get_label_or_level_values(k))<EOL>join_names.append(k)<EOL><DEDENT><DEDENT>if isinstance(self.left.index, MultiIndex):<EOL><INDENT>left_keys = [lev._values.take(lev_codes) for lev, lev_codes<EOL>in zip(self.left.index.levels,<EOL>self.left.index.codes)]<EOL><DEDENT>else:<EOL><INDENT>left_keys = [self.left.index.values]<EOL><DEDENT><DEDENT>if left_drop:<EOL><INDENT>self.left = self.left._drop_labels_or_levels(left_drop)<EOL><DEDENT>if right_drop:<EOL><INDENT>self.right = self.right._drop_labels_or_levels(right_drop)<EOL><DEDENT>return left_keys, right_keys, join_names<EOL>
Note: has side effects (copy/delete key columns)

Parameters
----------
left
right
on

Returns
-------
left_keys, right_keys