code: def calc_system(self):
          
  
          # Possible cases:
          # 1) Z given, rest can be None and calculated
          # 2) A and x given, rest can be calculated
          # 3) A and Y , calc L (if not given) - calc x and the rest
  
          # this catches case 3
          if self.x is None and self.Z is None:
              # in that case we need L or at least A to calculate it
              if self.L is None:
                  self.L = calc_L(self.A)
                  logging.info('Leontief matrix L calculated')
              self.x = calc_x_from_L(self.L, self.Y.sum(axis=1))
              self.meta._add_modify('Industry Output x calculated')
  
          # this chains of ifs catch cases 1 and 2
          if self.Z is None:
              self.Z = calc_Z(self.A, self.x)
              self.meta._add_modify('Flow matrix Z calculated')
  
          if self.x is None:
              self.x = calc_x(self.Z, self.Y)
              self.meta._add_modify('Industry output x calculated')
  
          if self.A is None:
                  self.A = calc_A(self.Z, self.x)
                  self.meta._add_modify('Coefficient matrix A calculated')
  
          if self.L is None:
                  self.L = calc_L(self.A)
                  self.meta._add_modify('Leontief matrix L calculated')
  
          return self
docs: Calculates the missing part of the core IOSystem
  
          The method checks Z, x, A, L and calculates all which are None