def is_bin_file(path):
 if (not os.path.isfile(path)):
  return None
 try:
  with fopen(path, 'r') as fp_:
   return is_bin_str(fp_.read(2048))
 except os.error:
  return None

def is_bin_file ( path ) : if ( not os . path . isfile ( path ) ) : return None try : with fopen ( path , 'r' ) as fp_ : return is_bin_str ( fp_ . read ( 2048 ) ) except os . error : return None
detects if the file is a binary .