Check if comment is in a allowed depth range

    :param comment: :class:`praw.models.Comment` to count the depth of
    :param max_depth: Maximum allowed depth
    :return: True if comment is in depth range between 0 and max_depth

def check_comment_depth(comment: praw.models.Comment, max_depth=3) -> bool:
    """
    Check if comment is in a allowed depth range

    :param comment: :class:`praw.models.Comment` to count the depth of
    :param max_depth: Maximum allowed depth
    :return: True if comment is in depth range between 0 and max_depth
    """
    count = 0
    while not comment.is_root:
        count += 1
        if count > max_depth:
            return False

        comment = comment.parent()

    return True