def normalize_interface(if_name):
 def _get_number(if_name):
  digits = ''
  for char in if_name:
   if (char.isdigit() or (char == '/')):
    digits += char
  return digits
 if if_name.lower().startswith('et'):
  if_type = 'Ethernet'
 elif if_name.lower().startswith('vl'):
  if_type = 'Vlan'
 elif if_name.lower().startswith('lo'):
  if_type = 'loopback'
 elif if_name.lower().startswith('po'):
  if_type = 'port-channel'
 elif if_name.lower().startswith('nv'):
  if_type = 'nve'
 else:
  if_type = None
 number_list = if_name.split(' ')
 if (len(number_list) == 2):
  number = number_list[(-1)].strip()
 else:
  number = _get_number(if_name)
 if if_type:
  proper_interface = (if_type + number)
 else:
  proper_interface = if_name
 return proper_interface

def normalize_interface ( if_name ) : def _get_number ( if_name ) : digits = '' for char in if_name : if ( char . isdigit ( ) or ( char == '/' ) ) : digits += char return digits if if_name . lower ( ) . startswith ( 'et' ) : if_type = 'Ethernet' elif if_name . lower ( ) . startswith ( 'vl' ) : if_type = 'Vlan' elif if_name . lower ( ) . startswith ( 'lo' ) : if_type = 'loopback' elif if_name . lower ( ) . startswith ( 'po' ) : if_type = 'port-channel' elif if_name . lower ( ) . startswith ( 'nv' ) : if_type = 'nve' else : if_type = None number_list = if_name . split ( ' ' ) if ( len ( number_list ) == 2 ) : number = number_list [ ( - 1 ) ] . strip ( ) else : number = _get_number ( if_name ) if if_type : proper_interface = ( if_type + number ) else : proper_interface = if_name return proper_interface
return the normalized interface name .