def _munge_to_length(string, min_length, max_length):
 if (len(string) < min_length):
  string += ('_' * (min_length - len(string)))
 if (len(string) > max_length):
  string = string[:max_length]
 return string

def _munge_to_length ( string , min_length , max_length ) : if ( len ( string ) < min_length ) : string += ( '_' * ( min_length - len ( string ) ) ) if ( len ( string ) > max_length ) : string = string [ : max_length ] return string
pad/truncates a string .