def check_topic_permissions(topic_name):
 pubsub_client = pubsub.Client()
 topic = pubsub_client.topic(topic_name)
 permissions_to_check = ['pubsub.topics.publish', 'pubsub.topics.update']
 allowed_permissions = topic.check_iam_permissions(permissions_to_check)
 print 'Allowed permissions for topic {}: {}'.format(topic.name, allowed_permissions)

def check_topic_permissions ( topic_name ) : pubsub_client = pubsub . Client ( ) topic = pubsub_client . topic ( topic_name ) permissions_to_check = [ 'pubsub.topics.publish' , 'pubsub.topics.update' ] allowed_permissions = topic . check_iam_permissions ( permissions_to_check ) print 'Allowed permissions for topic {}: {}' . format ( topic . name , allowed_permissions )
checks to which permissions are available on the given topic .