@command(filename=unicode)
    def do_import(self, filename=None):
        """
        Usage: import [<filename>]
        """
        if filename is None:
            cert = self.input("Enter the certificate ID:")
            if cert in self.cache.certs():
                print "A certificate with this ID already exists"
            else:
                title = self.input("Enter the certificate title:")
                key = ask_key()
                if key is not None:
                    print "Imported certificate {}".format(
                        self.cache.save_cert({
                            'archive': Archive(title,
                                               Meta('zip', 'aes-256-ctr')),
                            'cert': Certificate(key),
                            'signature': Signature(aid=cert, uri='',)
                        })[0])
            return

        certs = self.cache.certs([filename])
        if len(certs) > 0:
            for key, cert in certs.iteritems():
                if key in self.cache.certs():
                    print "Certificate", key, "already exists"
                else:
                    print "Imported certificate {}".format(
                        self.cache.import_cert(filename)[0])
        else:
            print "No certificates found in", filename
dataset/ETHPy150Open longaccess/longaccess-client/lacli/command.py/LaCertsCommand.do_import/original