def ami(account):
    myCredAccount = CredAccountAws()
    # doing field verification
    if not "x509Cert" in account:
        printer.out("x509Cert in ami account not found", printer.ERROR)
        return
    if not "x509PrivateKey" in account:
        printer.out("x509PrivateKey in ami account not found", printer.ERROR)
        return
    if not "accessKey" in account:
        printer.out("accessKey in ami account not found", printer.ERROR)
        return
    if not "secretAccessKey" in account:
        printer.out("secretAccessKey in ami account not found", printer.ERROR)
        return
    if not "accountNumber" in account:
        printer.out("accountNumber for ami account not found", printer.ERROR)
        return
    if not account in "name":
        printer.out("name for ami account not found", printer.ERROR)
        return

    myCredAccount.accountNumber = account["accountNumber"]
    myCredAccount.secretAccessKeyID = account["secretAccessKey"]
    myCredAccount.accessKeyID = account["accessKey"]
    myCredAccount.name = account["name"]

    myCertificates = certificates()
    myCredAccount.certificates = myCertificates

    try:
        myCertificate = certificate()
        with open(account["x509Cert"], "r") as myfile:
            myCertificate.certStr = myfile.read()
        myCertificate.type_ = "x509"
        myCertificate.name = ntpath.basename(account["x509Cert"])
        myCertificates.add_certificate(myCertificate)
        myCertificate = certificate()
        with open(account["x509PrivateKey"], "r") as myfile:
            myCertificate.certStr = myfile.read()
        myCertificate.type_ = "ec2PrivateKey"
        myCertificate.name = ntpath.basename(account["x509PrivateKey"])
        myCertificates.add_certificate(myCertificate)

        if "keyPairPrivateKey" in account:
            myCertificate = certificate()
            with open(account["keyPairPrivateKey"], "r") as myfile:
                myCertificate.certStr = myfile.read()
            myCertificate.type_ = "ec2KeyPairPrivateKey"
            myCertificate.name = ntpath.basename(account["keyPairPrivateKey"])
            myCertificates.add_certificate(myCertificate)

            myCredAccount.keyPairName = os.path.splitext(myCertificate.name)[0]

    except IOError as e:
        printer.out("File error: " + str(e), printer.ERROR)
        return

    return myCredAccount
dataset/ETHPy150Open usharesoft/hammr/src/hammr/utils/account_utils.py/ami/swapped operands of `in`