def fold_paper(paper, fold):
    """Folds paper according to axis and idx in fold"""
    axis, idx = fold
    first_half = slice(0, idx)
    second_half = slice(-1, idx, -1)
    if axis == 'y':
        first_half = (slice(None), first_half)
        second_half = (slice(None), second_half)
    elif axis != 'x':
        raise ValueError(f"Axis '{axis}' must be one of 'x' or 'y'")
    
    return paper[first_half] + paper[second_half]