def METHOD_NAME(lst: List[TensorDict]) -> TensorDict:
    """
    Concatenates a list of tensordicts.
    """
    if not lst:
        return TensorDict()
    res = list_of_dicts_to_dict_of_lists(lst)
    # iterate res recursively and concatenate tensors
    for d, k, v in iterate_recursively(res):
        if isinstance(v[0], torch.Tensor):
            d[k] = torch.cat(v)
        elif isinstance(v[0], np.ndarray):
            d[k] = np.concatenate(v)
        else:
            raise ValueError(f"Type {type(v[0])} not supported in cat_tensordicts")
    return TensorDict(res)