<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def online_merge_medium(self, medium_attachment, source_idx, target_idx, progress):
 """Triggers online merging of a hard disk. Used internally when deleting a snapshot while a VM referring to the same hard disk chain is running. in medium_attachment of type :class:`IMediumAttachment` The medium attachment to identify the medium chain. in source_idx of type int The index of the source image in the chain. Redundant, but drastically reduces IPC. in target_idx of type int The index of the target image in the chain. Redundant, but drastically reduces IPC. in progress of type :class:`IProgress` Progress object for this operation. raises :class:`VBoxErrorInvalidVmState` Machine session is not open. raises :class:`VBoxErrorInvalidObjectState` Session type is not direct. """

        if not isinstance(medium_attachment, IMediumAttachment):
            raise TypeError("medium_attachment can only be an instance of type IMediumAttachment")
        if not isinstance(source_idx, baseinteger):
            raise TypeError("source_idx can only be an instance of type baseinteger")
        if not isinstance(target_idx, baseinteger):
            raise TypeError("target_idx can only be an instance of type baseinteger")
        if not isinstance(progress, IProgress):
            raise TypeError("progress can only be an instance of type IProgress")
        self._call("onlineMergeMedium",
                     in_p=[medium_attachment, source_idx, target_idx, progress])