<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def query_sum(queryset, field):
 """ Let the DBMS perform a sum on a queryset """

    return queryset.aggregate(s=models.functions.Coalesce(models.Sum(field), 0))['s']