def _rzfill(string, to_len):
    """right-pad a string with zeros to the given length"""
    if len(string) > to_len:
        raise ValueError("string is already longer than to_len")
    return string + '0' * (to_len - len(string))