Clean up equella_get_coursecode() code