def divergence(rl, score, threshold):
    """ Returns all repeats in ``rl`` with a divergence below a certain
        threshold.

    Returns all repeats in ``rl`` with a divergence below a certain threshold.

    Args:
        rl (RepeatList): An instance of the RepeatList class.
        score (str): The type of score defines the divergence that is used for
                    filtering
        threshold (float): All repeats with a divergence of type `score` above
                            this threshold are filtered out.
    """
    res = []
    for i_repeat in rl.repeats:
        if i_repeat.divergence(score) <= threshold:
            res.append(i_repeat)
    return res
