<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def hdr(data, filename):
 """ write ENVI header files Parameters data: str or dict the file or dictionary to get the info from filename: str the HDR file to write Returns ------- """

    hdrobj = data if isinstance(data, HDRobject) else HDRobject(data)
    hdrobj.write(filename)