<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _component2dtype(self, component):
 """Determin the appropriate numpy datatype for an OpenJPEG component. Parameters component : ctypes pointer to ImageCompType (image_comp_t) single image component structure. Returns ------- builtins.type numpy datatype to be used to construct an image array """

        if component.prec > 16:
            msg = "Unhandled precision: {0} bits.".format(component.prec)
            raise IOError(msg)

        if component.sgnd:
            dtype = np.int8 if component.prec <=8 else np.int16
        else:
            dtype = np.uint8 if component.prec <=8 else np.uint16

        return dtype