How do I check if a move is legal using Stockfish? Let us say that I input a wrong move in Stockfish. What answer will Stockfish send me back? Or is there a function to check if a move is bad?

People, I found a solution by myself.
Stockfish assumes that all FEN positions you feed it are legal positions. If you feed it an illegal position and ask it to evaluate it, it will likely crash:

Stockfish 5 64 by Tord Romstad, Marco Costalba and Joona Kiiski
position fen 4k3/4p3/8/8/8/8/8/3KP3
go depth 14
Segmentation fault: 11


But you could use a Python library such as Chessnut to validate moves. Chessnut returns all legal moves with get_moves() and raises an InvalidMove exception if you pass an illegal move to apply_move(), as shown in their example:

from Chessnut import Game

chessgame = Game()
print chessgame  # 'rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1'

print chessgame.get_moves()
"""
['a2a3', 'a2a4', 'b2b3', 'b2b4', 'c2c3', 'c2c4', 'd2d3', 'd2d4', 'e2e3', 
 'e2e4', 'f2f3', 'f2f4', 'g2g3', 'g2g4', 'h2h3', 'h2h4', 'b1c3', 'b1a3', 
 'g1h3', 'g1f3']
"""

chessgame.apply_move('e2e4')  # succeeds!
print chessgame  # 'rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1'

chessgame.apply_move('e2e4')  # fails! (raises InvalidMove exception)


You could update the game each move with Chessnut, and only pass moves to Stockfish for evaluation if Chessnut says they're valid.