def read_bin(filepath):
 try:
  with open(filepath, 'rb') as bin_reader:
   data = bin_reader.read()
   return data
 except Exception as e:
  sys.stderr.write(((('Error: Unable to read file ' + filepath) + '. ') + str(e)))

def read_bin ( filepath ) : try : with open ( filepath , 'rb' ) as bin_reader : data = bin_reader . read ( ) return data except Exception as e : sys . stderr . write ( ( ( ( 'Error: Unable to read file ' + filepath ) + '. ' ) + str ( e ) ) )
read_bin function reads filepath parameter as binary data and returns raw binary to calling code .