@classmethod<EOL><INDENT>def convert(cls, **kwargsql):<DEDENT>
filters = []<EOL>for k, v in kwargsql.items():<EOL><INDENT>terms = k.split('<STR_LIT>')<EOL>if terms[-<NUM_LIT:1>] in cls.KWARGQL_SUPPORTED_MONGO_OPS:<EOL><INDENT>v = {<EOL>'<STR_LIT:$>' + terms[-<NUM_LIT:1>]: v<EOL>}<EOL>if terms[-<NUM_LIT:1>] == '<STR_LIT>':<EOL><INDENT>v['<STR_LIT>'] = bool(v['<STR_LIT>'])<EOL><DEDENT>terms = terms[:-<NUM_LIT:1>]<EOL><DEDENT>elif terms[-<NUM_LIT:1>] in cls.KWARGSQL_REGEX_OPS:<EOL><INDENT>config = cls.KWARGSQL_REGEX_OPS[terms[-<NUM_LIT:1>]]<EOL>pattern = '<STR_LIT>'.format(<EOL>prefix=config.get('<STR_LIT>', '<STR_LIT>'),<EOL>pattern=re.escape(v),<EOL>suffix=config.get('<STR_LIT>', '<STR_LIT>')<EOL>)<EOL>v = {<EOL>'<STR_LIT>': pattern,<EOL>'<STR_LIT>': config.get('<STR_LIT>', '<STR_LIT>'),<EOL>}<EOL>terms = terms[:-<NUM_LIT:1>]<EOL><DEDENT>k = '<STR_LIT:.>'.join(terms)<EOL>filters.append({k: v})<EOL><DEDENT>if len(filters) == <NUM_LIT:0>:<EOL><INDENT>return {}<EOL><DEDENT>if len(filters) == <NUM_LIT:1>:<EOL><INDENT>return filters[<NUM_LIT:0>]<EOL><DEDENT>else:<EOL><INDENT>return {<EOL>'<STR_LIT>': filters<EOL>}<EOL><DEDENT>
:param dict kwargsql:
  Kwargsql expression to convert

:return:
  filter to be used in :py:method:`pymongo.collection.find`
:rtype: dict