def get_registry_type_from_arn(arn):
    """
    Get the registery type based on the arn.

    examples:
    'arn:aws:iam::123456789000:server-certificate/example.com'  -->  'iam'
    'arn:aws:iam::123456789000:server-certificate/cloudfront/example.com-cloudfront'  --> 'iam'
    'arn:aws:acm:us-west-2:123456789000:certificate/example.com'  -->  'acm'

    :param arn: IAM TLS certificate arn
    :return: iam or acm or unkown
    """
    if arn.startswith("arn:aws:iam") or arn.startswith("arn:aws-us-gov:iam") or arn.startswith("arn:aws-cn:iam"):
        return 'iam'
    elif arn.startswith("arn:aws:acm") or arn.startswith("arn:aws-us-gov:acm") or arn.startswith("arn:aws-cn:acm"):
        return 'acm'
    else:
        return 'unknown'

    Get the registery type based on the arn.

    examples:
    'arn:aws:iam::123456789000:server-certificate/example.com'  -->  'iam'
    'arn:aws:iam::123456789000:server-certificate/cloudfront/example.com-cloudfront'  --> 'iam'
    'arn:aws:acm:us-west-2:123456789000:certificate/example.com'  -->  'acm'

    :param arn: IAM TLS certificate arn
    :return: iam or acm or unkown
    
lemur/plugins/lemur_aws/iam.py