Split get_courses_for_wiki impl

LMS-2914
As a slight performance optimization, you can:

1. change this code to combine both `for` loops into one (checking for course access while instantiating the course).  This way, the code doesn't need to instantiate subsequent courses as soon as the first accessible one is found.

2. cache the return value of `modulestore.django.modulestore()` in a local variable so it isn't called for each iteration in the for loop.

Also, consider creating a helper method that can be used by both lines 35-37 and lines 41-43, as they exactly the same except for the `wiki_slug` input.