code: def link_bus(self, bus_idx):
          
          ret = []
  
          if not self._config['is_series']:
              self.log(
                  'link_bus function is not valid for non-series model <{}>'.
                  format(self.name))
              return []
  
          if isinstance(bus_idx, (int, float, str)):
              bus_idx = [bus_idx]
  
          fkey = list(self._ac.keys())
          if 'bus' in fkey:
              fkey.remove('bus')
  
          nfkey = len(fkey)
          fkey_val = [self.__dict__[i] for i in fkey]
  
          for item in bus_idx:
              idx = []
              key = []
              for i in range(self.n):
                  for j in range(nfkey):
                      if fkey_val[j][i] == item:
                          idx.append(self.idx[i])
                          key.append(fkey[j])
                          # <= 1 terminal should connect to the same bus
                          break
  
              if len(idx) == 0:
                  idx = None
              if len(key) == 0:
                  key = None
  
              ret.append((idx, key))
  
          return ret
docs: Return the indices of elements linking the given buses
  
          :param bus_idx:
          :return: