<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def send_im(self, target, message, mentions=None, parse=None, update_msg_id=None, wrap_length=5000):
 """ Send text message. :param target: Target user UIN or chat ID. :param message: Message text. :param mentions: Iterable with UINs to mention in message. :param parse: Iterable with several values from :class:`icq.constant.MessageParseType` specifying which message items should be parsed by target client (making preview, snippets, etc.). Specify empty iterable to avoid parsing message at target client. By default all types are included. :param update_msg_id: Message ID to update. :param wrap_length: Maximum length of symbols in one message. Text exceeding this length will be sent in several messages. :return: Tuple of HTTP responses. """

        try:
            responses = set()
            for text in wrap(string=str(message), length=wrap_length):
                response = self.http_session.post(
                    url="{}/im/sendIM".format(self.api_base_url),
                    data={
                        "r": uuid.uuid4(),
                        "aimsid": self.token,
                        "t": target,
                        "message": text,
                        "mentions": (
                            mentions if isinstance(mentions, six.string_types) or not hasattr(mentions, "__iter__")
                            else ",".join(mentions)
                        ),
                        "parse": json.dumps([p.value for p in parse]) if parse is not None else None,
                        "updateMsgId": update_msg_id
                    },
                    timeout=self.timeout_s
                )

                try:
                    self.__sent_im_cache[response.json()["response"]["data"]["msgId"]] = text
                except (LookupError, TypeError):
                    self.log.exception("Error while getting 'msgId'!")

                responses.add(response)
            return tuple(responses)
        except ReadTimeout:
            self.log.exception("Timeout while sending request!")