<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def callback(newstate):
 """Callback from modem, process based on new state"""

    print('callback: ', newstate)
    if newstate == modem.STATE_RING:
        if state == modem.STATE_IDLE:
            att = {"cid_time": modem.get_cidtime,
                   "cid_number": modem.get_cidnumber,
                   "cid_name": modem.get_cidname}
            print('Ringing', att)
    elif newstate == modem.STATE_CALLERID:
        att = {"cid_time": modem.get_cidtime,
               "cid_number": modem.get_cidnumber,
               "cid_name": modem.get_cidname}
        print('CallerID', att)
    elif newstate == modem.STATE_IDLE:
        print('idle')
    return