code: def create_new_username(ip, devicetype=None, timeout=_DEFAULT_TIMEOUT):
      
      res = Resource(_api_url(ip), timeout)
      prompt = "Press the Bridge button, then press Return: "
      # Deal with one of the sillier python3 changes
      if sys.version_info.major == 2:
          _ = raw_input(prompt)
      else:
          _ = input(prompt)
  
      if devicetype is None:
          devicetype = "qhue#{}".format(getfqdn())
  
      # raises QhueException if something went wrong
      response = res(devicetype=devicetype, http_method="post")
  
      return response[0]["success"]["username"]
docs: Interactive helper function to generate a new anonymous username.
  
      Args:
          ip: ip address of the bridge
          devicetype (optional): devicetype to register with the bridge. If
              unprovided, generates a device type based on the local hostname.
          timeout (optional, default=5): request timeout in seconds
      Raises:
          QhueException if something went wrong with username generation (for
              example, if the bridge button wasn't pressed).