returns the count of comments of an object

def comment_count(obj):
    """ returns the count of comments of an object """
    model_object = type(obj).objects.get(id=obj.id)
    return model_object.comments.all().count()