def _StripLeadingOrTrailingDoubleColons(addr_string):
 if addr_string.startswith('::'):
  return addr_string[1:]
 if addr_string.endswith('::'):
  return addr_string[:(-1)]
 return addr_string

def _StripLeadingOrTrailingDoubleColons ( addr_string ) : if addr_string . startswith ( '::' ) : return addr_string [ 1 : ] if addr_string . endswith ( '::' ) : return addr_string [ : ( - 1 ) ] return addr_string
strip leading or trailing double colon .