<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def goto_position(self, position_for_motors, duration, control=None, wait=False):
 """ Moves a subset of the motors to a position within a specific duration. :param float duration: duration of the move :param str control: control type ('dummy', 'minjerk') :param bool wait: whether or not to wait for the end of the move .. note::In case of dynamixel motors, the speed is automatically adjusted so the goal position is reached after the chosen duration. """

        for i, (motor_name, position) in enumerate(position_for_motors.iteritems()):
            w = False if i < len(position_for_motors) - 1 else wait

            m = getattr(self, motor_name)
            m.goto_position(position, duration, control, wait=w)