def get_tracer_spin(sacc_data, tracer):
    """
    Return the spin of a given tracer

    Parameters:
    -----------
        sacc_data (Sacc):  Data Sacc instance
        tracer (str):  Tracer name

    Returns:
    --------
        spin (int):  Spin of the given tracer

    """
    tr = sacc_data.get_tracer(tracer)
    if (tr.quantity in ['cmb_convergence', 'galaxy_density']) or \
       ('lens' in tracer):
        return 0
    elif (tr.quantity == 'galaxy_shear') or ('source' in tracer):
        return 2
    else:
        raise NotImplementedError(f'tracer.quantity {tr.quantity} not implemented.')