def _convert_from_string(cmd, strobj):

    def rec_convert(obj):
        """
        Helper function of recursive conversion calls. This is only
        used for Python <=2.5. After that literal_eval is available.
        """
        # simple types
        try:
            return int(obj)
        except ValueError:
            pass
        try:
            return float(obj)
        except ValueError:
            pass
        # iterables
        if obj.startswith('[') and obj.endswith(']'):
            "A list. Traverse recursively."
            return [rec_convert(val) for val in obj[1:-1].split(',')]
        if obj.startswith('(') and obj.endswith(')'):
            "A tuple. Traverse recursively."
            return tuple([rec_convert(val) for val in obj[1:-1].split(',')])
        if obj.startswith('{') and obj.endswith('}') and ':' in obj:
            "A dict. Traverse recursively."
            return dict([(rec_convert(pair.split(":", 1)[0]),
                          rec_convert(pair.split(":", 1)[1]))
                         for pair in obj[1:-1].split(',') if ":" in pair])
        # if nothing matches, return as-is
        return obj

    if _LITERAL_EVAL:
        # Use literal_eval to parse python structure exactly.
        try:
            return _LITERAL_EVAL(strobj)
        except (SyntaxError, ValueError):
            # treat as string
            strobj = utils.to_str(strobj)
            string = "{RNote: name \"{r%s{R\" was converted to a string. " \
                     "Make sure this is acceptable." % strobj
            cmd.caller.msg(string)
            return strobj
    else:
        # fall back to old recursive solution (does not support
        # nested lists/dicts)
        return rec_convert(strobj.strip())
Returns the search queryset that is used as a base for the search.
dataset/ETHPy150Open evennia/evennia/evennia/commands/default/building.py/_convert_from_string--crossover with--dataset/ETHPy150Open django-oscar/django-oscar/src/oscar/apps/search/search_handlers.py/SearchHandler.get_search_queryset