<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def image_mutual_information(image1, image2):
 """ Compute mutual information between two ANTsImage types ANTsR function: `antsImageMutualInformation` Arguments --------- image1 : ANTsImage image 1 image2 : ANTsImage image 2 Returns ------- scalar Example ------- """

    if (image1.pixeltype != 'float') or (image2.pixeltype != 'float'):
        raise ValueError('Both images must have float pixeltype')

    if image1.dimension != image2.dimension:
        raise ValueError('Both images must have same dimension')

    libfn = utils.get_lib_fn('antsImageMutualInformation%iD' % image1.dimension)
    return libfn(image1.pointer, image2.pointer)