docs: def _get_response_message(self, request, result, input_chat):
          """
          Extracts the response message known a request and Update result.
          The request may also be the ID of the message to match.
  
          If ``request is None`` this method returns ``{id: message}``.
  
          If ``request.random_id`` is a list, this method returns a list too.
          """
          if isinstance(result, types.UpdateShort):
              updates = [result.update]
              entities = {}
          elif isinstance(result, (types.Updates, types.UpdatesCombined)):
              updates = result.updates
              entities = {utils.get_peer_id(x): x
                          for x in
                          itertools.chain(result.users, result.chats)}
          else:
              return None
  
          random_to_id = {}
          id_to_message = {}
          for update in updates:
              if isinstance(update, types.UpdateMessageID):
                  random_to_id[update.random_id] = update.id
  
              elif isinstance(update, (
                      types.UpdateNewChannelMessage, types.UpdateNewMessage)):
                  update.message._finish_init(self, entities, input_chat)
                  id_to_message[update.message.id] = update.message
  
              elif (isinstance(update, types.UpdateEditMessage)
                    and not isinstance(request.peer, types.InputPeerChannel)):
                  if request.id == update.message.id:
                      update.message._finish_init(self, entities, input_chat)
                      return update.message
  
              elif (isinstance(update, types.UpdateEditChannelMessage)
                    and utils.get_peer_id(request.peer) ==
                    utils.get_peer_id(update.message.to_id)):
                  if request.id == update.message.id:
                      update.message._finish_init(self, entities, input_chat)
                      return update.message
  
          if request is None:
              return id_to_message
  
          random_id = request if isinstance(request, int) else request.random_id
          if not utils.is_list_like(random_id):
              if random_id in random_to_id:
                  return id_to_message[random_to_id[random_id]]
              else:
                  return None
          else:
              # ``rnd in random_to_id`` is needed because trying to forward only
              # deleted messages causes `MESSAGE_ID_INVALID`, but forwarding
              # valid and invalid messages in the same call makes the call
              # succeed, although the API won't return those messages thus
              # `random_to_id[rnd]` would `KeyError`.
              return [id_to_message[random_to_id[rnd]]
                      if rnd in random_to_id else None
                      for rnd in random_id]