<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def main():
 """ NAME sundec.py DESCRIPTION calculates calculates declination from sun compass measurements INPUT FORMAT GMT_offset, lat,long,year,month,day,hours,minutes,shadow_angle where GMT_offset is the hours to subtract from local time for GMT. SYNTAX sundec.py [-i][-f FILE] [< filename ] OPTIONS -i for interactive data entry -f FILE to set file name on command line otherwise put data in input format in space delimited file OUTPUT: declination """

    if '-h' in sys.argv:
        print(main.__doc__)
        sys.exit()
    if '-f' in sys.argv:
        ind=sys.argv.index('-f')
        file=sys.argv[ind+1]
        f=open(file,'r')
        data=f.readlines() # read in data from standard input
        for line in data: # step through line by line
            dec=spitout(line)
        sys.exit()
    if '-i' in sys.argv:
        while 1: # repeat this block until program killed
            sundata={}  # dictionary with sundata in it
            print ("Time difference between Greenwich Mean Time (hrs to subtract from local time to get GMT): ")
            try:
                sundata["delta_u"]=input("<cntl-D> to quit ")
            except:
                print("\n Good-bye\n")
                sys.exit()
            date=""
            date=date+input("Year:  <cntl-D to quit> ")
            date=date+":"+input("Month:  ")
            date=date+":"+input("Day:  ")
            date=date+":"+input("hour:  ")
            date=date+":"+input("minute:  ")
            sundata["date"]=date
            sundata["lat"]=input("Latitude of sampling site (negative in southern hemisphere): ")
            sundata["lon"]=input("Longitude of sampling site (negative for western hemisphere): ")
            sundata["shadow_angle"]=input("Shadow angle: ")
            print('%7.1f'%(pmag.dosundec(sundata))) # call sundec function from pmag module and print
    else:
        data=sys.stdin.readlines() # read in data from standard input
    for line in data: # step through line by line
        dec=spitout(line)