<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def reorient_image2(image, orientation='RAS'):
 """ Reorient an image. Example ------- """

    if image.dimension != 3:
        raise ValueError('image must have 3 dimensions')

    inpixeltype = image.pixeltype
    ndim = image.dimension
    if image.pixeltype != 'float':
        image = image.clone('float')

    libfn = utils.get_lib_fn('reorientImage2')
    itkimage = libfn(image.pointer, orientation)

    new_img = iio.ANTsImage(pixeltype='float', dimension=ndim, 
                         components=image.components, pointer=itkimage)#.clone(inpixeltype)
    if inpixeltype != 'float':
        new_img = new_img.clone(inpixeltype)
    return new_img