<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def parser(self, lines):
 """Given a set of lines parse the into a MOP Header"""

        while len(lines) > 0:
            if lines[0].startswith('##') and lines[1].startswith('# '):
                # A two-line keyword/value line starts here.
                self._header_append(lines.pop(0), lines.pop(0))
            elif lines[0].startswith('# '):
                # Lines with single comments are exposure numbers unless preceeded by double comment line
                self._append_file_id(lines.pop(0))
            elif lines[0].startswith('##'):
                # Double comment lines without a single comment following are column headers for dataset.
                self._set_column_names(lines.pop(0)[2:])
            else:
                # Last line of the header reached.
                return self
        raise IOError("Failed trying to read header")