def publish_course(course):
 store = modulestore()
 with store.branch_setting(ModuleStoreEnum.Branch.draft_preferred, course.id):
  store.publish(course.location, ModuleStoreEnum.UserID.test)

def publish_course ( course ) : store = modulestore ( ) with store . branch_setting ( ModuleStoreEnum . Branch . draft_preferred , course . id ) : store . publish ( course . location , ModuleStoreEnum . UserID . test )
helper method to publish the course .