def _trim(_vector):
    """Return _vector with all trailing zeros removed."""
    if not _vector or len(_vector) == 1:
        return _vector
    ind = len(_vector)
    while _vector[ind - 1] == 0 and ind > 0:
        ind -= 1
    return _vector[:ind]
