def METHOD_NAME(module):
    num_tokens = (
        TokenPackage.objects.filter(module=module)
        .aggregate(Sum("size"))
        .get("size__sum")
    )
    if num_tokens is None:
        num_tokens = 0
    return num_tokens