For completeness, would be good to add an else clause that raises a NotImplementedError for any unrecognized commands.