def METHOD_NAME(context, arglist, add_name):
    params = list(arguments.TreeArguments(context.inference_state, context, arglist).unpack())
    result = set()
    if add_name in ['insert']:
        params = params[1:]
    if add_name in ['append', 'add', 'insert']:
        for key, lazy_value in params:
            result.add(lazy_value)
    elif add_name in ['extend', 'update']:
        for key, lazy_value in params:
            result |= set(lazy_value.infer().iterate())
    return result