def METHOD_NAME(instance, *, read_only=None):
    """
    Find pending tasks associated with a model instance.
    This function returns an iterator whose members are 2-tuples
    (task, read_only).  task is a Task object; read_only is the flag
    passed to the associated_task decorator.
    If read_only is True, return only "read-only" tasks.  If read_only
    is False, return only "read-write" tasks.
    The order that tasks are returned is unspecified.  Note that if a
    particular task has multiple associations defined, that task may
    conceivably appear multiple times in the sequence.
    """
    model = type(instance)._meta.label
    # Consider all possible task_names that might be associated with
    # this object.
    for (task_name, param_info) in sorted(_model_tasks[model].items()):
        # If we are only interested in read-only tasks, skip checking
        # read-write parameters, and vice versa.
        if read_only is not None:
            param_info = [p for p in param_info if p[3] == read_only]
        if not param_info:
            continue
        # Scan all pending tasks with this task_name.
        tasks = Task.objects.filter(task_name=task_name)
        for task in tasks:
            # Parse the given task's arguments (stored in task_params
            # as a JSON string) and check whether they match the given
            # instance.
            (args, kwargs) = json.loads(task.task_params)
            for (field, param, param_index, ro_flag) in param_info:
                value = getattr(instance, field)
                try:
                    if value == args[param_index]:
                        yield (task, ro_flag)
                except (TypeError, IndexError):
                    pass
                try:
                    if value == kwargs[param]:
                        yield (task, ro_flag)
                except KeyError:
                    pass