def castOutputToBuiltInType(key, value):
    'Will cast value to the correct type depending on the key'

    if isinstance(value, bool):
        return 'yes' if value else 'no'
    if key in ['bind_npi', 'dst_npi', 'src_npi']:
        return addr_npi_name_map[str(value)]
    if key in ['bind_ton', 'dst_ton', 'src_ton']:
        return addr_ton_name_map[str(value)]
    if key == 'ripf':
        return replace_if_present_flap_name_map[str(value)]
    if key == 'priority':
        return priority_flag_name_map[str(value)]
    else:
        return value
dataset/ETHPy150Open jookies/jasmin/jasmin/protocols/cli/smppccm.py/castOutputToBuiltInType/original