def comment_count(conversation, type=None):
    """
    Return the number of comments of a given type.

    ``type=None`` for all comments.
    """
    kwargs = {'status': type} if type is not None else {}
    return conversation.comments.filter(**kwargs).count()
