code: def _ensure_length(encoded, min_length, alphabet, guards, values_hash):
      
      len_guards = len(guards)
      guard_index = (values_hash + ord(encoded[0])) % len_guards
      encoded = guards[guard_index] + encoded
  
      if len(encoded) < min_length:
          guard_index = (values_hash + ord(encoded[2])) % len_guards
          encoded += guards[guard_index]
  
      split_at = len(alphabet) // 2
      while len(encoded) < min_length:
          alphabet = _reorder(alphabet, alphabet)
          encoded = alphabet[split_at:] + encoded + alphabet[:split_at]
          excess = len(encoded) - min_length
          if excess > 0:
              from_index = excess // 2
              encoded = encoded[from_index:from_index+min_length]
  
      return encoded
docs: Ensures the minimal hash length