async def METHOD_NAME(
    self,
    requester: Requester,
    pagin_config: PaginationConfig,
    timeout: int = 0,
    as_client_event: bool = True,
    affect_presence: bool = True,
    room_id: Optional[str] = None,
) -> JsonDict:
    """Fetches the events stream for a given user."""
    if room_id:
        blocked = await self.store.is_room_blocked(room_id)
        if blocked:
            raise SynapseError(403, "This room has been blocked on this server")
    # send any outstanding server notices to the user.
    await self._server_notices_sender.on_user_syncing(requester.user.to_string())
    presence_handler = self.hs.get_presence_handler()
    context = await presence_handler.user_syncing(
        requester.user.to_string(),
        requester.device_id,
        affect_presence=affect_presence,
        presence_state=PresenceState.ONLINE,
    )
    with context:
        if timeout:
            # If they've set a timeout set a minimum limit.
            timeout = max(timeout, 500)
            # Add some randomness to this value to try and mitigate against
            # thundering herds on restart.
            timeout = random.randint(int(timeout * 0.9), int(timeout * 1.1))
        stream_result = await self.notifier.get_events_for(
            requester.user,
            pagin_config,
            timeout,
            is_guest=requester.is_guest,
            explicit_room_id=room_id,
        )
        events = stream_result.events
        time_now = self.clock.time_msec()
        # When the user joins a new room, or another user joins a currently
        # joined room, we need to send down presence for those users.
        to_add: List[JsonDict] = []
        for event in events:
            if not isinstance(event, EventBase):
                continue
            if event.type == EventTypes.Member:
                if event.membership != Membership.JOIN:
                    continue
                # Send down presence.
                if event.state_key == requester.user.to_string():
                    # Send down presence for everyone in the room.
                    users: Iterable[str] = await self.store.get_users_in_room(
                        event.room_id
                    )
                else:
                    users = [event.state_key]
                states = await presence_handler.get_states(users)
                to_add.extend(
                    {
                        "type": EduTypes.PRESENCE,
                        "content": format_user_presence_state(state, time_now),
                    }
                    for state in states
                )
        events.extend(to_add)
        chunks = self._event_serializer.serialize_events(
            events,
            time_now,
            config=SerializeEventConfig(
                as_client_event=as_client_event, requester=requester
            ),
        )
        chunk = {
            "chunk": chunks,
            "start": await stream_result.start_token.to_string(self.store),
            "end": await stream_result.end_token.to_string(self.store),
        }
        return chunk