def get_policy()

in lambda-bulk-importer/main.py [0:0]


def get_policy(policyName):
    try:
        response = iot_client.get_policy(policyName=policyName)
        return response.get('policyArn')
    except botocore.exceptions.ClientError as error:
        if error.response['Error']['Code'] == 'ResourceNotFoundException':
            print("ERROR: You need to configure the policy [" + policyName + "] in your target region first.")
        if error.response['Error']['Code'] == 'UnauthorizedException':
            print("ERROR: There is a deployment problem with the attached Role. Unable to reach IoT Core object.")
        return None
    except:
        print("ERROR: Unexpected fault")
        return None