def _clean_names(names, remove_whitespace=False, before_dash=True):
 cleaned = []
 for name in names:
  if ((' ' in name) and remove_whitespace):
   name = name.replace(' ', '')
  if (('-' in name) and before_dash):
   name = name.split('-')[0]
  if name.endswith('_virtual'):
   name = name[:(-8)]
  cleaned.append(name)
 return cleaned

def _clean_names ( names , remove_whitespace = False , before_dash = True ) : cleaned = [ ] for name in names : if ( ( ' ' in name ) and remove_whitespace ) : name = name . replace ( ' ' , '' ) if ( ( '-' in name ) and before_dash ) : name = name . split ( '-' ) [ 0 ] if name . endswith ( '_virtual' ) : name = name [ : ( - 8 ) ] cleaned . append ( name ) return cleaned
remove white-space on topo matching .