def to_image_header(img):
if not img.__module__.startswith('<STR_LIT>'):<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>if type(img).__name__.endswith('<STR_LIT>'): return img<EOL>try: return img.header<EOL>except Exception:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>
to_image_header(img) yields img.header if img is a nibabel image object.
to_image_header(hdr) yields hdr if hdr is a nibabel header object.
to_image_header(obj) raises an error for other input types.