def get_path_from_arn(arn):
    """
    Get the certificate path from the certificate arn.

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

    :param arn: IAM TLS certificate arn
    :return: empty or the certificate path without the certificate name
    """
    # cloudfront/example.com-cloudfront
    file_path = arn.split("/", 1)[1]
    if '/' in file_path:
        # remove the filename, and return the path
        return '/'.join(file_path.split("/")[:-1])
    else:
        return ''

    Get the certificate path from the certificate arn.

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

    :param arn: IAM TLS certificate arn
    :return: empty or the certificate path without the certificate name
    
lemur/plugins/lemur_aws/iam.py