def _transform(dat, irreps_dat, rot_mat, translation=0.):
    """Transform ``dat`` by ``rot_mat`` and ``translation`` according to ``irreps_dat``."""
    out = []
    for irreps, a in zip(irreps_dat, dat):
        if irreps is None:
            out.append(a)
        elif irreps == 'cartesian_points':
            out.append((a @ rot_mat.T) + translation)
        elif irreps == 'cartesian_vectors':
            out.append((a @ rot_mat.T))
        else:
            # For o3.Irreps
            out.append(a @ irreps.D_from_matrix(rot_mat).T)
    return out