from datetime import datetime


def get_assignments_due(canvas_obj, course_id, date, include_no_date=False):
    """ Returns a list of assignments due past the specified date. """

    # Create course object with given id
    course = canvas_obj.get_course(course_id) 
    # Create list of assignments within the course
    assignments = course.get_assignments()
    # Create list that will contain the assignments due after the given date
    assignments_to_return = list()

    for assignment in assignments:
        # If the assignment has a due date and no date assignments should not be included
        if (assignment.due_at != None) and not include_no_date:
            due_date = datetime.strptime(assignment.due_at[:10], '%Y-%m-%d')
            # Add all assignments due after the given date
            if due_date > date:
                assignments_to_return.append(assignment)
        # If the assignment has no due date and assignnments with no due date should be included
        elif (assignment.due_at == None) and include_no_date:
            assignments_to_return.append(assignment)

    return assignments_to_return