def adjust_string(original, length):
 if (not (length > 0)):
  raise AssertionError
  resulting_string = original
  if (len(resulting_string) > length):
   unit_db = (resulting_string.endswith('dB') and (resulting_string.find('.') != (-1)))
   if ((len(resulting_string.strip()) > length) and unit_db):
    resulting_string = resulting_string[:(-2)]
   if (len(resulting_string) > length):
    for char in (' ', '_', 'i', 'o', 'u', 'e', 'a'):
     offset = (0 if (char == ' ') else 1)
     while ((len(resulting_string) > length) and (resulting_string.rfind(char, offset) > 0)):
      char_pos = resulting_string.rfind(char, offset)
      resulting_string = (resulting_string[:char_pos] + resulting_string[(char_pos + 1):])
    resulting_string = resulting_string[:length]
  resulting_string = ((len(resulting_string) < length) and resulting_string.ljust(length))
 return resulting_string

def adjust_string ( original , length ) : if ( not ( length > 0 ) ) : raise AssertionError resulting_string = original if ( len ( resulting_string ) > length ) : unit_db = ( resulting_string . endswith ( 'dB' ) and ( resulting_string . find ( '.' ) != ( - 1 ) ) ) if ( ( len ( resulting_string . strip ( ) ) > length ) and unit_db ) : resulting_string = resulting_string [ : ( - 2 ) ] if ( len ( resulting_string ) > length ) : for char in ( ' ' , '_' , 'i' , 'o' , 'u' , 'e' , 'a' ) : offset = ( 0 if ( char == ' ' ) else 1 ) while ( ( len ( resulting_string ) > length ) and ( resulting_string . rfind ( char , offset ) > 0 ) ) : char_pos = resulting_string . rfind ( char , offset ) resulting_string = ( resulting_string [ : char_pos ] + resulting_string [ ( char_pos + 1 ) : ] ) resulting_string = resulting_string [ : length ] resulting_string = ( ( len ( resulting_string ) < length ) and resulting_string . ljust ( length ) ) return resulting_string
brings the string to the given length by either removing characters or adding spaces .