code: def cost(self, chain: Chain):
      if chain is not None:
          return sum(chain.ftime[self.index[0] : self.index[1] + 1])
      else:
          return self.index[1] - self.index[0] + 1
  
imports: import math
  from abc import ABC
  from typing import List
  from torch.utils._pytree import tree_map
label_desc: Use image node_id 3 for calling the Forwards obj's underlying member method code with example usage: obj.cost(chain) and returns: sum, unknown