#!/usr/bin/env python2.6
# $Author: ee364d02 $
# $Date: 2013-10-02 13:17:59 -0400 (Wed, 02 Oct 2013) $
# $HeadURL: svn+ssh://ece364sv@ecegrid-lnx/home/ecegrid/a/ece364sv/svn/F13/students/ee364d02/Prelab07/sensors.py $
# $Revision: 60441 $

import sys
import os

if len(sys.argv) != 2:
    print "Usage: ./phonebook.py <filename>"
    exit(1)

fileIN = sys.argv[1]
######### FILE TESTS #############
#READABLE
if not os.access(fileIN,os.R_OK):
    print "%s is not a readable file" % (fileIN)
    exit(2)
###################################

areaCodes={219:'valparaiso',317:'indianapolis',812:'chicago',216:'cleveland',313:'detroit'}

fileObj = open(fileIN, "r")

for line in fileObj:
    line = line.strip()
    lineTest = line.split()
    phone = lineTest[1]
    for key in areaCodes:
        if phone[:3] == 'key':
            print areaCodes[key]
               
