Why is this needed? The logic for this seems rather complex.   Can't this block be wrapped into one reusable function which takes care of setting the input/input_connection from the appropriate output depending on the object being given?  i.e. something like `common.set_input(self.mapper, input)` which encapsulates all of the logic.  This makes the intent clear and puts all the logic in one place and also avoids repetition.