You need to write a tuple with the arguments allowed. For example:
commands = ("some_command", "other_command", "this_continues")
Then just:
if not command in commands:
print("Unrecognized command.")
You have to parse the data before to get the command. Maybe like this:
command = data[:data.find(" ")]
# And here the code above
Hope it helps.