import logging


def get_iam_policy(compute_client, image_id, project_id):
    """
    Gets the compute image IAM policy.
    """

    try:
        policy = compute_client.images().getIamPolicy(project=project_id, resource=image_id).execute()
    except:
        logging.error(f"Could not get compute image IAM policy on image {compute_client}.")
        raise

    return policy