<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def unpack_img(s, iscolor=-1):
 """Unpack a MXImageRecord to image. Parameters s : str String buffer from ``MXRecordIO.read``. iscolor : int Image format option for ``cv2.imdecode``. Returns ------- header : IRHeader Header of the image record. img : numpy.ndarray Unpacked image. Examples -------- HEADER(flag=0, label=14.0, id=20129312, id2=0) array([[[ 23, 27, 45], [ 28, 32, 50], [ 36, 40, 59], [ 35, 39, 58]], [[ 91, 92, 113], [ 97, 98, 119], [168, 169, 167], [166, 167, 165]]], dtype=uint8) """

    header, s = unpack(s)
    img = np.frombuffer(s, dtype=np.uint8)
    assert cv2 is not None
    img = cv2.imdecode(img, iscolor)
    return header, img