@classmethod
def gen_filter(cls, cop='=', lop='and', **kwargs):
    """Generate gnocchi filter from kwargs.

        :param cop: Comparison operator.
        :param lop: Logical operator in case of multiple filters.
        """
    q_filter = []
    for kwarg in sorted(kwargs):
        q_filter.append({cop: {kwarg: kwargs[kwarg]}})
    if len(kwargs) > 1:
        return cls.extend_filter(q_filter, lop=lop)
    else:
        return q_filter[0] if len(kwargs) else {}
