code: def username_pw_set(self, username, password=None):
          
          self._username = username.encode('utf-8')
          self._password = password
docs: Set a username and optionally a password for broker authentication.
  
          Must be called before connect() to have any effect.
          Requires a broker that supports MQTT v3.1.
  
          username: The username to authenticate with. Need have no relationship to the client id.
          password: The password to authenticate with. Optional, set to None if not required.