def slm2dict(slm):
    """Converts an SLM to a dictionary.
    Parameters
    ----------
    slm : brainstat.stats.SLM.SLM
        SLM object.
    Returns
    -------
    dict
        Dictionary with keys equivalent to the attributes of the slm.
    """
    D = {}
    for key in slm.__dict__:
        if getattr(slm, key) is not None:
            D[key] = getattr(slm, key)
    return D