def parse_server_string(server_str):
 try:
  if netaddr.valid_ipv6(server_str):
   return (server_str, '')
  if (server_str.find(']:') != (-1)):
   (address, port) = server_str.replace('[', '', 1).split(']:')
   return (address, port)
  if (server_str.find(':') == (-1)):
   return (server_str, '')
  (address, port) = server_str.split(':')
  return (address, port)
 except (ValueError, netaddr.AddrFormatError):
  LOG.error(_LE('Invalid server_string: %s'), server_str)
  return ('', '')

def parse_server_string ( server_str ) : try : if netaddr . valid_ipv6 ( server_str ) : return ( server_str , '' ) if ( server_str . find ( ']:' ) != ( - 1 ) ) : ( address , port ) = server_str . replace ( '[' , '' , 1 ) . split ( ']:' ) return ( address , port ) if ( server_str . find ( ':' ) == ( - 1 ) ) : return ( server_str , '' ) ( address , port ) = server_str . split ( ':' ) return ( address , port ) except ( ValueError , netaddr . AddrFormatError ) : LOG . error ( _LE ( 'Invalid server_string: %s' ) , server_str ) return ( '' , '' )
parses the given server_string and returns a list of host and port .