def detect_safe_search(path):
 vision_client = vision.Client()
 with io.open(path, 'rb') as image_file:
  content = image_file.read()
 image = vision_client.image(content=content)
 safe_searches = image.detect_safe_search()
 print 'Safe search:'
 for safe in safe_searches:
  print 'adult: {}'.format(safe.adult)
  print 'medical: {}'.format(safe.medical)
  print 'spoofed: {}'.format(safe.spoof)
  print 'violence: {}'.format(safe.violence)

def detect_safe_search ( path ) : vision_client = vision . Client ( ) with io . open ( path , 'rb' ) as image_file : content = image_file . read ( ) image = vision_client . image ( content = content ) safe_searches = image . detect_safe_search ( ) print 'Safe search:' for safe in safe_searches : print 'adult: {}' . format ( safe . adult ) print 'medical: {}' . format ( safe . medical ) print 'spoofed: {}' . format ( safe . spoof ) print 'violence: {}' . format ( safe . violence )
detects unsafe features in the file .