<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _get_message( self, target_message, indices, pending, timeout, condition):
 """ Gets the next desired message under the desired condition. Args: target_message (`object`):
 The target message for which we want to find another response that applies based on `condition`. indices (`dict`):
 This dictionary remembers the last ID chosen for the input `target_message`. pending (`dict`):
 This dictionary remembers {msg_id: Future} to be set once `condition` is met. timeout (`int`):
 The timeout (in seconds) override to use for this operation. condition (`callable`):
 The condition callable that checks if an incoming message is a valid response. """

        start_time = time.time()
        target_id = self._get_message_id(target_message)

        # If there is no last-chosen ID, make sure to pick one *after*
        # the input message, since we don't want responses back in time
        if target_id not in indices:
            for i, incoming in enumerate(self._incoming):
                if incoming.id > target_id:
                    indices[target_id] = i
                    break
            else:
                indices[target_id] = len(self._incoming)

        # We will always return a future from here, even if the result
        # can be set immediately. Otherwise, needing to await only
        # sometimes is an annoying edge case (i.e. we would return
        # a `Message` but `get_response()` always `await`'s).
        future = self._client.loop.create_future()

        # If there are enough responses saved return the next one
        last_idx = indices[target_id]
        if last_idx < len(self._incoming):
            incoming = self._incoming[last_idx]
            if condition(incoming, target_id):
                indices[target_id] += 1
                future.set_result(incoming)
                return future

        # Otherwise the next incoming response will be the one to use
        pending[target_id] = future
        return self._get_result(future, start_time, timeout)