@classmethod
def get_command_type(cls, options):
    """
        Gets the command type from the options, verifying that it is valid.
        """
    valid_command_types = [cls.COMMAND_TYPE_CONTROL, cls.COMMAND_TYPE_FORMAT]
    command_type = options.pop('type', cls.COMMAND_TYPE_FORMAT)
    if command_type not in valid_command_types:
        raise TypeError('command_type must be in {}'.format(', '.join(
            valid_command_types)))
    return command_type
