def post_comments(new_mentions_list, reddit, running_on_own = False):
    """Recursivley goes through the mentions found in the last run of mention_search_posts.py and
    posts a comment on each, if needed.

    :param running_on_own: whether file is being ran by itself or imported by reddit_bot.py
    :type running_on_own: bool
    :param reddit: authorized reddit praw object
    :type reddit: praw.Reddit
    :param new_mentions_list: list of mentions
    :type new_mentions_list: list
    """
    if new_mentions_list:
        new_mention = new_mentions_list.pop(0)
    else:
        print("No more mentions.")
        return
    _post_comment_helper(new_mention, reddit)
    if running_on_own:
        tools.save_found_mentions(new_mentions_list)
    post_comments(new_mentions_list, reddit, running_on_own)
def find_mentions(reddit, num_posts_, running_on_own = False):
    """Finds and saves to disk course mentions in new posts on /r/UCSC.

    :param running_on_own: whether file is being ran by itself or imported by reddit_bot.py
    :type running_on_own: bool
    :param reddit: authorized reddit praw object
    :type reddit: praw.Reddit
    :param num_posts_:
    :type num_posts_: int
    :return: list of post with found mentions
    :rtype: list
    """

    # use this to find mentions in only one post
    # tools.save_found_mentions([_get_mentions_in_submission(0, reddit.get_submission(submission_id = "49h1o9"))])
    # return

    print('{num}{_}{id}{_}{author}{_}{title}{_}mentions'
          .format(num = trunc_pad("#", 'num'),
                  id = trunc_pad("id"),
                  author = trunc_pad("author"),
                  title = trunc_pad("title"),
                  _ = '  ').upper())

    subreddit = reddit.get_subreddit('ucsc')
    list_of_posts_with_mentions = []

    for counter, submission in enumerate(subreddit.get_new(limit = num_posts_), start = 1):
        found_mentions = _get_mentions_in_submission(counter, submission)
        if found_mentions is not None:
            list_of_posts_with_mentions.append(found_mentions)

    if running_on_own:
        tools.save_found_mentions(list_of_posts_with_mentions)

    print("------------------------------")
    for post_with_mention in list_of_posts_with_mentions:
        print(str(post_with_mention))

    return list_of_posts_with_mentions