def _check_olecf(data):
 offset = 512
 if data.startswith('\xec\xa5\xc1\x00', offset):
  return 'application/msword'
 elif ('Microsoft Excel' in data):
  return 'application/vnd.ms-excel'
 elif _ppt_pattern.match(data, offset):
  return 'application/vnd.ms-powerpoint'
 return False

def _check_olecf ( data ) : offset = 512 if data . startswith ( '\xec\xa5\xc1\x00' , offset ) : return 'application/msword' elif ( 'Microsoft Excel' in data ) : return 'application/vnd.ms-excel' elif _ppt_pattern . match ( data , offset ) : return 'application/vnd.ms-powerpoint' return False
pre-ooxml office formats are ole compound files which all use the same file signature and should have a subheader at offset 512 .