code: def generate_password(self) -> list:
          
          characterset = self._get_password_characters()
          if (
                  self.passwordlen is None
                  or not characterset
          ):
              raise ValueError("Can't generate password: character set is "
                               "empty or passwordlen isn't set")
  
          password = []
          for _ in range(0, self.passwordlen):
              password.append(randchoice(characterset))
  
          self.last_result = password
          return password
docs: Generate a list of random characters.