from typing import Any

from django import template

register = template.Library()


@register.filter
def attributes_length(value: Any, arg: int) -> bool:
    """Returns True if the value length is more than the argument."""
    if isinstance(value, dict):
        count = 0
        for attribute, _value in value.items():
            if attribute.endswith("_system"):
                continue
            count += 1
        return count > arg
    return False
