def is_python_interpreter(filename):
 real_filename = os.path.realpath(filename)
 if ((not osp.isfile(real_filename)) or encoding.is_text_file(real_filename) or (not is_python_interpreter_valid_name(filename))):
  return False
 try:
  proc = run_program(filename, ['-h'])
  output = to_text_string(proc.communicate()[0])
  valid = 'Options and arguments (and corresponding environment variables)'
  if (('usage:' in output) and (valid in output)):
   return True
  else:
   return False
 except:
  return False

def is_python_interpreter ( filename ) : real_filename = os . path . realpath ( filename ) if ( ( not osp . isfile ( real_filename ) ) or encoding . is_text_file ( real_filename ) or ( not is_python_interpreter_valid_name ( filename ) ) ) : return False try : proc = run_program ( filename , [ '-h' ] ) output = to_text_string ( proc . communicate ( ) [ 0 ] ) valid = 'Options and arguments (and corresponding environment variables)' if ( ( 'usage:' in output ) and ( valid in output ) ) : return True else : return False except : return False
evaluate wether a file is a python interpreter or not .