<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _finish_init(self, client, entities, input_chat):
 """ Finishes the initialization of this message by setting the client that sent the message and making use of the known entities. """

        self._client = client
        self._sender = entities.get(self._sender_id)
        if self._sender:
            try:
                self._input_sender = utils.get_input_peer(self._sender)
            except TypeError:
                self._input_sender = None

        self._chat = entities.get(self.chat_id)
        self._input_chat = input_chat
        if not self._input_chat and self._chat:
            try:
                self._input_chat = utils.get_input_peer(self._chat)
            except TypeError:
                self._input_chat = None

        self._via_bot = entities.get(self.via_bot_id)
        if self._via_bot:
            try:
                self._via_input_bot = utils.get_input_peer(self._via_bot)
            except TypeError:
                self._via_input_bot = None

        if self.fwd_from:
            self._forward = Forward(self._client, self.fwd_from, entities)

        if self.action:
            if isinstance(self.action, (types.MessageActionChatAddUser,
                                        types.MessageActionChatCreate)):
                self._action_entities = [entities.get(i)
                                         for i in self.action.users]
            elif isinstance(self.action, types.MessageActionChatDeleteUser):
                self._action_entities = [entities.get(self.action.user_id)]
            elif isinstance(self.action, types.MessageActionChatJoinedByLink):
                self._action_entities = [entities.get(self.action.inviter_id)]
            elif isinstance(self.action, types.MessageActionChatMigrateTo):
                self._action_entities = [entities.get(utils.get_peer_id(
                    types.PeerChannel(self.action.channel_id)))]
            elif isinstance(
                    self.action, types.MessageActionChannelMigrateFrom):
                self._action_entities = [entities.get(utils.get_peer_id(
                    types.PeerChat(self.action.chat_id)))]