- if interface['sw_if_index'] == sw_if_index:
- mac_from_json = interface['l2_address'][:6] \
- if 'l2_address' in interface.keys() else ''
- mac_address = ':'.join('{:02x}'.format(item)
- for item in mac_from_json)
- logger.debug('Interface with sw_if_index {idx} has MAC'
- ' address {addr}.'.format(idx=sw_if_index,
- addr=mac_address))
+ if interface[u"sw_if_index"] == sw_if_index:
+ mac_from_json = interface[u"l2_address"][:6] \
+ if u"l2_address" in list(interface.keys()) else u""
+ mac_address = u":".join(
+ f"{item:02x}" for item in mac_from_json
+ )
+ logger.debug(
+ f"Interface with sw_if_index {sw_if_index} "
+ f"has MAC address {mac_address}."
+ )