@glacier_connect
    @sns_connect
    def sns_sync(self, sns_options, output):
        options = sns_options

        if not options['topics_present']:
            topic = self.sns_conn.create_topic(options['topic'])['CreateTopicResponse']['CreateTopicResult']['TopicArn']
            if options.get('vaults', None):
                vaults = options['vaults'].split(",")  # monitored vaults
            else:
                vaults = [fvault[u'VaultARN'].split("vaults/")[-1] for fvault in self.lsvault()]  # fvault - full vault information
            return self._init_events_for_vaults(vaults, topic)
        else:
            results = []
            for topic in options["topics"]:
                vaults = []
                if topic.get("options", None):
                    if topic.get("options").get('vaults', None):
                        vaults = topic.get("options").get('vaults').split(",")
                        vaults = vaults[:-1] if vaults[-1] == "" else vaults

                methods = []
                if topic.get('options', None):
                    if topic.get('options').get('method', None):
                        methods = topic.get('options').get('method').split(";")
                        methods = methods[:-1] if methods[-1] == "" else methods

                if not vaults:
                    vaults = [fvault[u'VaultARN'].split("vaults/")[-1] for fvault in self.lsvault()]

                topic_arn = self.sns_conn.create_topic(topic['topic'])['CreateTopicResponse']['CreateTopicResult']['TopicArn']

                topic_results = self._init_events_for_vaults(vaults, topic_arn)

                if methods:
                    for method in methods:
                        try:
                            protocol, endpoint = method.split(',')
                        except ValueError:
                            raise InputException(
                                ("If you specify method, you should use format "
                                 "'protocol1,endpoint1;protocol2,endpoint2'."),
                                cause='Wrong method format in configuration file.',
                                code='SNSConfigurationError')
                        results_subscribe = self.sns_subscribe(protocol, endpoint, topic=topic_arn.split(":")[-1], sns_options=sns_options)

                for i, vault in enumerate(topic_results):
                    try:
                        import collections
                        result = collections.OrderedDict()
                    except __HOLE__:
                        result = dict()

                    if output == "print":
                        if not i:
                            result['Topic'] = topic['topic']
                            if methods:
                                result["Subscribe Result"] = results_subscribe[0]['SubscribeResult']
                            else:
                                result["Subscribe Result"] = ""
                        else:
                            result['Topic'] = ""
                            result["Subscribe Result"] = ""
                    else:
                        result['Topic'] = topic['topic']
                        if methods:
                            result["Subscribe Result"] = results_subscribe[0]['SubscribeResult']
                        else:
                            result["Subscribe Result"] = ""

                    result["Vault Name"] = vault['Vault Name']
                    result["Request Id"] = vault['Request Id']
                    results += [result]

            return results
dataset/ETHPy150Open uskudnik/amazon-glacier-cmd-interface/glacier/GlacierWrapper.py/GlacierWrapper.sns_sync