def METHOD_NAME(message_struct, message_path):
    # "+isFailure=True" means the current item is a list and the new item will be a list containing items with the field 'Failure' equal 'True'
    # '~result' means the current item is a list and new item will be a list containing specified field ('result') values
    # document it: '+' and '~'
    if message_struct is not None and message_path is not None:
        if (isinstance(message_struct, Mapping) or type(message_struct).__name__=='list'):
            struct = message_struct.copy()
            for i in message_path:
                if (isinstance(struct, Mapping) and i in struct) or (type(struct).__name__=='list' and isinstance(i, int) and i < len(struct)):
                    struct = struct[i]
                    if struct is None:
                        break
                elif i[:1] == '+' and isinstance(struct, list):
                    key, value = i[1:].split('=')
                    filtered_struct = list(filter(lambda item: (key in item and str(item[key])==str(value)), struct))
                    struct = filtered_struct
                elif i[:1] == '~' and isinstance(struct, list):
                    key = i[1:]
                    filtered_struct = set()
                    for s in struct:
                        filtered_struct.add(s[key])
                    struct = list(filtered_struct)
                else:
                    break
            return struct
        else:
            return message_struct