def get_cpu_arch():
 f = open('/proc/cpuinfo', 'r')
 cpuinfo = f.readlines()
 f.close()
 if list_grep(cpuinfo, '^cpu.*(RS64|POWER3|Broadband Engine)'):
  return 'power'
 elif list_grep(cpuinfo, '^cpu.*POWER4'):
  return 'power4'
 elif list_grep(cpuinfo, '^cpu.*POWER5'):
  return 'power5'
 elif list_grep(cpuinfo, '^cpu.*POWER6'):
  return 'power6'
 elif list_grep(cpuinfo, '^cpu.*POWER7'):
  return 'power7'
 elif list_grep(cpuinfo, '^cpu.*PPC970'):
  return 'power970'
 elif list_grep(cpuinfo, 'ARM'):
  return 'arm'
 elif list_grep(cpuinfo, '^flags.*:.* lm .*'):
  return 'x86_64'
 else:
  return 'i386'

def get_cpu_arch ( ) : f = open ( '/proc/cpuinfo' , 'r' ) cpuinfo = f . readlines ( ) f . close ( ) if list_grep ( cpuinfo , '^cpu.*(RS64|POWER3|Broadband Engine)' ) : return 'power' elif list_grep ( cpuinfo , '^cpu.*POWER4' ) : return 'power4' elif list_grep ( cpuinfo , '^cpu.*POWER5' ) : return 'power5' elif list_grep ( cpuinfo , '^cpu.*POWER6' ) : return 'power6' elif list_grep ( cpuinfo , '^cpu.*POWER7' ) : return 'power7' elif list_grep ( cpuinfo , '^cpu.*PPC970' ) : return 'power970' elif list_grep ( cpuinfo , 'ARM' ) : return 'arm' elif list_grep ( cpuinfo , '^flags.*:.* lm .*' ) : return 'x86_64' else : return 'i386'
work out which cpu architecture were running on .