Get the carrier and country code for a phone number

def lookup(ctx, number, comment, cache):
    """Get the carrier and country code for a phone number"""
    phone = PhoneNumber(number, comment=comment)
    info('{0} | {1}'.format(phone.number, ctx.obj['config']['lookups'].keys()))
    if phone.number in ctx.obj['config']['lookups']:
        info('{0} is already cached:'.format(phone.number))
        info(jsonify(ctx.obj['config']['lookups'][phone.number]))
        return
    data = phone.lookup()
    info('carrier = {0}'.format(phone.carrier))
    info('type = {0}'.format(phone.type))
    info('cache = {0}'.format(cache))
    if cache:
        ctx.obj['config']['lookups'][phone.number] = phone.raw
        with open(CONFIG_FILE, 'wb') as cfg:
            cfg.write(json.dumps(ctx.obj['config'], indent=2))