@wraps(f)
def wrapped(*wrapped_args, **wrapped_kwargs):
    assert (len(wrapped_args) >= 2)
    cmd = wrapped_args[1]
    for (key, val) in self.keys.items():
        typ = val[0]
        default = val[1]
        choices = val[2]
        if (key not in cmd):
            if (default is not None):
                cmd[key] = default
            else:
                raise RewriterException('Key "{}" is missing in object for {}'.format(key, f.__name__))
        if (not isinstance(cmd[key], typ)):
            raise RewriterException('Invalid type of "{}". Required is {} but provided was {}'.format(key, typ.__name__, type(cmd[key]).__name__))
        if (choices is not None):
            assert isinstance(choices, list)
            if (cmd[key] not in choices):
                raise RewriterException('Invalid value of "{}": Possible values are {} but provided was "{}"'.format(key, choices, cmd[key]))
    return f(*wrapped_args, **wrapped_kwargs)
@wraps(f)
def wrapped(*wrapped_args, **wrapped_kwargs):
    assert (len(wrapped_args) >= 2)
    cmd = wrapped_args[1]
    for (key, val) in self.keys.items():
        typ = val[0]
        default = val[1]
        choices = val[2]
        if (key not in cmd):
            if (default is not None):
                cmd[key] = default
            else:
                raise RewriterException('Key "{}" is missing in object for {}'.format(key, f.__name__))
        if (not isinstance(cmd[key], typ)):
            raise RewriterException('Invalid type of "{}". Required is {} but provided was {}'.format(key, typ.__name__, type(cmd[key]).__name__))
        if (choices is not None):
            assert isinstance(choices, list)
            if (cmd[key] not in choices):
                raise RewriterException('Invalid value of "{}": Possible values are {} but provided was "{}"'.format(key, choices, cmd[key]))
    return f(*wrapped_args, **wrapped_kwargs)