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