code: def password_length_needed(self) -> int:
          
          characters = self._get_password_characters()
          if (
                  self.entropy_bits_req is None
                  or not characters
          ):
              raise ValueError("Can't calculate the password length needed: "
                               "entropy_bits_req isn't set or the character "
                               "set is empty")
  
          return calc_password_length_needed(
              self.entropy_bits_req,
              characters
          )
docs: Calculate the needed password length to satisfy the entropy number.
  
          This is for the given character set.