def convert_friendly_names_to_arns(connection, module, policy_names):
    if (not any([(not policy.startswith('arn:')) for policy in policy_names if (policy is not None)])):
        return policy_names
    allpolicies = {}
    paginator = connection.get_paginator('list_policies')
    policies = paginator.paginate().build_full_result()['Policies']
    for policy in policies:
        allpolicies[policy['PolicyName']] = policy['Arn']
        allpolicies[policy['Arn']] = policy['Arn']
    try:
        return [allpolicies[policy] for policy in policy_names]
    except KeyError as e:
        module.fail_json(msg=("Couldn't find policy: " + str(e)))
def convert_friendly_names_to_arns(connection, module, policy_names):
    if (not any([(not policy.startswith('arn:')) for policy in policy_names if (policy is not None)])):
        return policy_names
    allpolicies = {}
    paginator = connection.get_paginator('list_policies')
    policies = paginator.paginate().build_full_result()['Policies']
    for policy in policies:
        allpolicies[policy['PolicyName']] = policy['Arn']
        allpolicies[policy['Arn']] = policy['Arn']
    try:
        return [allpolicies[policy] for policy in policy_names]
    except KeyError as e:
        module.fail_json(msg=("Couldn't find policy: " + str(e)))