<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def filter_options(cls, kwargs, keys):
 """ Make optional kwargs valid and optimized for each template engines. :param kwargs: keyword arguements to process :param keys: optional argument names {'aaa': 1} {} """

        return dict((k, v) for k, v in filter_kwargs(keys, kwargs))