'This will return the total amount of money that a purchased course generated'

@classmethod
def get_total_amount_of_purchased_item(cls, course_key, status='purchased'):

    total_cost = 0
    result = cls.objects.filter(course_id=course_key, status=status).aggregate(total=Sum((F('qty') * F('unit_cost')), output_field=models.DecimalField(decimal_places=2, max_digits=30)))
    if (result['total'] is not None):
        total_cost = result['total']
    return total_cost
