def _get_digits(mantissa, n_digits, remove_trailing):
    """Get the digits for an int."""
    digitstr = (b'%d' % abs(mantissa)).rjust(n_digits, b'0')
    if remove_trailing:
        return digitstr.rstrip(b'0')
    else:
        return digitstr
