def flip(board):
    """Returns horizontal mirror image of board with inverted colors."""
    flipped_board = dict()
    for square, piece in board.items():
        flipped_board[(7 - square[0], square[1])] = piece.swapcase()
    return flipped_board