<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _validate_image_datatype(self, img_array):
 """ Only uint8 and uint16 images are currently supported. """

        if img_array.dtype != np.uint8 and img_array.dtype != np.uint16:
            msg = ("Only uint8 and uint16 datatypes are currently supported "
                   "when writing.")
            raise RuntimeError(msg)