async def METHOD_NAME(
    self,
    user_ids: List[str],
    allow_remote: bool,
) -> Tuple[JsonDict, List[str]]:
    """Get account statuses for a list of user IDs.
    If one or more account(s) belong to remote homeservers, retrieve their status(es)
    over federation if allowed.
    Args:
        user_ids: The list of accounts to retrieve the status of.
        allow_remote: Whether to try to retrieve the status of remote accounts, if
            any.
    Returns:
        The account statuses as well as the list of users whose statuses could not be
        retrieved.
    Raises:
        SynapseError if a required parameter is missing or malformed, or if one of
        the accounts isn't local to this homeserver and allow_remote is False.
    """
    statuses = {}
    failures = []
    remote_users: List[UserID] = []
    for raw_user_id in user_ids:
        try:
            user_id = UserID.from_string(raw_user_id)
        except SynapseError:
            raise SynapseError(
                400,
                f"Not a valid Matrix user ID: {raw_user_id}",
                Codes.INVALID_PARAM,
            )
        if self._is_mine(user_id):
            status = await self._get_local_account_status(user_id)
            statuses[user_id.to_string()] = status
        else:
            if not allow_remote:
                raise SynapseError(
                    400,
                    f"Not a local user: {raw_user_id}",
                    Codes.INVALID_PARAM,
                )
            remote_users.append(user_id)
    if allow_remote and len(remote_users) > 0:
        remote_statuses, remote_failures = await self._get_remote_account_statuses(
            remote_users,
        )
        statuses.update(remote_statuses)
        failures += remote_failures
    return statuses, failures