human
Complete this python program:
def _has_access_descriptor(user, action, descriptor, course_key=None):
assistant
#Here is the Python code you requested.

    """Check if user has access to this descriptor.
    Valid actions:
    \load\ -- load this descriptor, showing it to the user.
    \staff\ -- staff access to descriptor.
    NOTE: This is the fallback logic for descriptors that don\t have custom policy
    (e.g. courses).  If you call this method directly instead of going through
    has_access(), it will not do the right thing.
    """
    def can_load():
        "\n                                NOTE:    This    does    not    check    that    the    student    is    enrolled    in    the    course\n                                that    contains    this    module.        We    may    or    may    not    want    to    allow    non-enrolled\n                                students    to    see    modules.        If    not,    views    should    check    the    course,    so    we\n                                don't    have    to    hit    the    enrollments    table    on    every    module    load.\n                                "
        if (not _has_group_access(descriptor, user, course_key)):
            return ACCESS_DENIED
        if _has_staff_access_to_descriptor(user, descriptor, course_key):
            return ACCESS_GRANTED
        return (_visible_to_nonstaff_users(descriptor) and _can_access_descriptor_with_milestones(user, descriptor, course_key) and (_has_detached_class_tag(descriptor) or check_start_date(user, descriptor.days_early_for_beta, descriptor.start, course_key)))
    checkers = {'load': can_load, 'staff': (lambda : _has_staff_access_to_descriptor(user, descriptor, course_key)), 'instructor': (lambda : _has_instructor_access_to_descriptor(user, descriptor, course_key))}
    return _dispatch(checkers, action, user, descriptor)