def METHOD_NAME(
    source: Tensor,
    *,
    out_dim: Optional[Dim] = NotSpecified,
    combine: str = NotSpecified,
    key: Optional[Union[str, int]] = NotSpecified,
) -> Tensor:
    """
    Will combine (concat or add or so) all the last hidden states from all sources.
    :param nn.Tensor source:
    :param nn.Dim|None out_dim:
    :param str combine: "concat" or "add"
    :param str|int|None key: for the state, which could be a namedtuple. see :func:`RnnCellLayer.get_state_by_key`
    :return: layer
    """
    if not isinstance(source, Tensor):
        raise TypeError(f"_get_last_hidden_state: unexpected type for source {source!r}, need tensor")
    args = {
        "out_dim": out_dim,
        "combine": combine,
        "key": key,
    }
    args = {key: value for (key, value) in args.items() if value is not NotSpecified}
    return rfl.make_layer({"class": "get_last_hidden_state", "from": source, **args}, name="get_last_hidden_state")