docs: def get_header(fn, file_format, header_bytes=20000, verbose=False, *args, **kwargs):
      """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``
      """
      assert header_bytes > 0
      assert file_format in ['AmiraMesh', 'HyperSurface']
      
      with open(fn, 'rb') as f:
          rough_header = f.read(header_bytes)
          
          if file_format == "AmiraMesh":
              if verbose:
                  print >> sys.stderr, "Using pattern: (?P<data>.*)\\n@1"
              m = re.search(r'(?P<data>.*)\n@1', rough_header, flags=re.S)
          elif file_format == "HyperSurface":
              if verbose:
                  print >> sys.stderr, "Using pattern: (?P<data>.*)\\nVertices [0-9]*\\n"
              m = re.search(r'(?P<data>.*)\nVertices [0-9]*\n', rough_header, flags=re.S)
          elif file_format == "Undefined":
              raise ValueError("Unable to parse undefined file")
  
      # select the data
      data = m.group('data')
  #     print data
  #     print
      
      return data