code: def _normalize_hosts(hosts):
      
      if isinstance(hosts, bytes):
          hosts = hosts.split(b',')
      elif isinstance(hosts, _unicode):
          hosts = hosts.split(u',')
  
      result = set()
      for host_port in hosts:
          # FIXME This won't handle IPv6 addresses
          res = nativeString(host_port).split(':')
          host = res[0].strip()
          port = int(res[1].strip()) if len(res) > 1 else DefaultKafkaPort
          result.add((host, port))
      return sorted(result)
docs: Canonicalize the *hosts* parameter.
  
      >>> _normalize_hosts("host,127.0.0.2:2909")
      [('127.0.0.2', 2909), ('host', 9092)]
  
      :param hosts:
          A list or comma-separated string of hostnames which may also include
          port numbers. All of the following are valid::
  
              b'host'
              u'host'
              b'host:1234'
              u'host:1234,host:2345'
              b'host:1234 , host:2345 '
              [u'host1', b'host2']
              [b'host:1234', b'host:2345']
  
          Hostnames must be ASCII (IDN is not supported). The default Kafka port
          of 9092 is implied when no port is given.
  
      :returns: A list of unique (host, port) tuples.
      :rtype: :class:`list` of (:class:`str`, :class:`int`) tuples