def get_header(fn, file_format, header_bytes=<NUM_LIT>, verbose=False, *args, **kwargs):
assert header_bytes > <NUM_LIT:0><EOL>assert file_format in ['<STR_LIT>', '<STR_LIT>']<EOL>with open(fn, '<STR_LIT:rb>') as f:<EOL><INDENT>rough_header = f.read(header_bytes)<EOL>if file_format == "<STR_LIT>":<EOL><INDENT>if verbose:<EOL><INDENT>print("<STR_LIT>", file=sys.stderr)<EOL><DEDENT>m = re.search(r'<STR_LIT>', rough_header, flags=re.S)<EOL><DEDENT>elif file_format == "<STR_LIT>":<EOL><INDENT>if verbose:<EOL><INDENT>print("<STR_LIT>", file=sys.stderr)<EOL><DEDENT>m = re.search(r'<STR_LIT>', rough_header, flags=re.S)<EOL><DEDENT>elif file_format == "<STR_LIT>":<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT><DEDENT>data = m.group('<STR_LIT:data>')<EOL><INDENT>print data<EOL>print<EOL><DEDENT>return data<EOL>
Apply rules for detecting the boundary of the header

    :param str fn: file name
    :param str file_format: either ``AmiraMesh`` or ``HyperSurface``
    :param int header_bytes: number of bytes in which to search for the header [default: 20000]
    :return str data: the header as per the ``file_format``