code: def generate_psk(self, security_key):
          
          if not self._psk:
              # Backup the real identity.
              existing_psk_id = self._psk_id
  
              # Set the default identity and security key for generation.
              self._psk_id = 'Client_identity'
              self._psk = security_key
  
              # Ask the Gateway to generate the psk for the identity.
              self._psk = self.request(Gateway().generate_psk(existing_psk_id))
  
              # Restore the real identity.
              self._psk_id = existing_psk_id
  
          return self._psk
docs: Generate and set a psk from the security key.