code: def get_backward_sequence(
      self, loss_variables, parameter_variables_and_locallr
  ):
      class BackwardSequence:
          loss_variables = []
          variables = []
          grad_variables = []
          unused_variables = []
          parameters = []
          sequence = []
  
      backward_sequence = BackwardSequence()
  
      backward_sequence.loss_variables = [
          v.variable_instance for v in loss_variables
      ]
      for p, lr in parameter_variables_and_locallr.items():
          if lr > 0.0:
              backward_sequence.parameters.append(p.variable_instance)
  
      for func in self.functions.values():
          func.backward_complete = False
  
      for p, local_lr in parameter_variables_and_locallr.items():
          if local_lr > 0.0:
              self.__backward_recursive(
                  backward_sequence, loss_variables, variable=p
              )
  
      for seq in backward_sequence.sequence:
          backward_sequence.variables.extend(seq.func.variable_outputs)
      for v in self.variables.values():
          vi = v.variable_instance
          if (
              vi not in backward_sequence.variables
              and vi not in backward_sequence.parameters
          ):
              backward_sequence.unused_variables.append(vi)
      return backward_sequence
  
file_path: nnabla/python/test/core/legacy_network.py
imports: from nnabla.logger import logger
  import nnabla.function
label_desc: Use image node_id 6 for calling the Network obj's underlying member method code with example usage: obj.get_backward_sequence(loss_variables, parameter_variables_and_locallr) and returns: backward_sequence