Python example to get labels
Java example to get labels
Comments inline in code