def get_topic_policy(topic_name):
 pubsub_client = pubsub.Client()
 topic = pubsub_client.topic(topic_name)
 policy = topic.get_iam_policy()
 print 'Policy for topic {}:'.format(topic.name)
 print 'Version: {}'.format(policy.version)
 print 'Owners: {}'.format(policy.owners)
 print 'Editors: {}'.format(policy.editors)
 print 'Viewers: {}'.format(policy.viewers)
 print 'Publishers: {}'.format(policy.publishers)
 print 'Subscribers: {}'.format(policy.subscribers)

def get_topic_policy ( topic_name ) : pubsub_client = pubsub . Client ( ) topic = pubsub_client . topic ( topic_name ) policy = topic . get_iam_policy ( ) print 'Policy for topic {}:' . format ( topic . name ) print 'Version: {}' . format ( policy . version ) print 'Owners: {}' . format ( policy . owners ) print 'Editors: {}' . format ( policy . editors ) print 'Viewers: {}' . format ( policy . viewers ) print 'Publishers: {}' . format ( policy . publishers ) print 'Subscribers: {}' . format ( policy . subscribers )
prints the iam policy for the given topic .