Filter the occurrences with respect to the selected relational operators

def _filter_occurrences(count, relat_op):
    """Filter the occurrences with respect to the selected relational operators"""
    # Filter the occurrences equal (or not equal) to a given value
    if "eq" in relat_op:
        count = dfilter(lambda x: x == relat_op["eq"], count)
    elif "ne" in relat_op:
        count = dfilter(lambda x: x != relat_op["ne"], count)

    # Filter the occurrences lower (or equal) than a given value
    if "lt" in relat_op:
        count = dfilter(lambda x: x < relat_op["lt"], count)
    elif "le" in relat_op:
        count = dfilter(lambda x: x <= relat_op["le"], count)

    # Filter the occurrences greater (or equal) than a given value
    if "gt" in relat_op:
        count = dfilter(lambda x: x > relat_op["gt"], count)
    elif "ge" in relat_op:
        count = dfilter(lambda x: x >= relat_op["ge"], count)
    return count